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()
|
||||
|
||||
const id = req.query.person
|
||||
const person = await Teacher.findById(id)
|
||||
const data = encodePerson(person)
|
||||
const data = await Teacher.findById(id)
|
||||
|
||||
if (data) {
|
||||
res.json(data)
|
||||
res.json(encodePerson(data))
|
||||
} else {
|
||||
res.status(404)
|
||||
res.json({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import ImageArtifactType from '../core/ImageArtifactType'
|
||||
import { encodeImage } from './image'
|
||||
const profilePicture = profile => profile.picture.getPicture(ImageArtifactType.BIG)
|
||||
|
||||
export function encodePerson(person) {
|
||||
@@ -7,5 +8,6 @@ export function encodePerson(person) {
|
||||
shortName: person.shortName(),
|
||||
name: person.splitName(),
|
||||
picture: profilePicture(person),
|
||||
preview: encodeImage(person.picture),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user