working demo

This commit is contained in:
Siwat Sirichai 2024-05-05 18:44:40 +07:00
parent b194d2031d
commit a8de581c09
6 changed files with 216 additions and 27 deletions

View file

@ -97,6 +97,9 @@ router.get('/parent/:parent_upn', async function (req, res) {
allowedAttributes.forEach(function (attribute) {
parent[attribute] = req.user[attribute];
});
// Get the list of students linked to the parent
let students = await directory.getStudentsByParent(parent.username);
parent.students = students;
res.json(parent);
});

View file

@ -64,6 +64,8 @@ router.get('/student/:upn', function (req, res) {
allowedAttributes.forEach(function (attribute) {
student[attribute] = req.user[attribute];
});
// Return the student's linked parent in the response in JSON format
student['primary_parent'] = req.user['primaryParent'];
res.json(student);
});