api person update
This commit is contained in:
1 parent
464485a52c
commit
e67d8ab40e
2 files changed
+4
-3
No files matched your search
@@ -6,11 +6,10 @@ export default async (req, res) => {
|
|||||||
await connect()
|
await connect()
|
||||||
|
|
||||||
const id = req.query.person
|
const id = req.query.person
|
||||||
const person = await Teacher.findById(id)
|
const data = await Teacher.findById(id)
|
||||||
const data = encodePerson(person)
|
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
res.json(data)
|
res.json(encodePerson(data))
|
||||||
} else {
|
} else {
|
||||||
res.status(404)
|
res.status(404)
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import ImageArtifactType from '../core/ImageArtifactType'
|
import ImageArtifactType from '../core/ImageArtifactType'
|
||||||
|
import { encodeImage } from './image'
|
||||||
const profilePicture = profile => profile.picture.getPicture(ImageArtifactType.BIG)
|
const profilePicture = profile => profile.picture.getPicture(ImageArtifactType.BIG)
|
||||||
|
|
||||||
export function encodePerson(person) {
|
export function encodePerson(person) {
|
||||||
@@ -7,5 +8,6 @@ export function encodePerson(person) {
|
|||||||
shortName: person.shortName(),
|
shortName: person.shortName(),
|
||||||
name: person.splitName(),
|
name: person.splitName(),
|
||||||
picture: profilePicture(person),
|
picture: profilePicture(person),
|
||||||
|
preview: encodeImage(person.picture),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user