issue #126 implemented

parent b5d0af59
......@@ -130,7 +130,7 @@ module.exports = {
"tape_background": "#00ffff",
"delivery": 0
}
}
}
*/
getInfo: function (req, res) {
Student.findOne({id: req.params.id_stu})
......@@ -169,6 +169,20 @@ module.exports = {
if (student.supervision == -1) // should not hace access!!!
return res.forbidden("Access to this student should not be granted to you");
// Promisify asynchronous call to Student.supervisors
var supervisors = new Promise(function(resolve, reject) {
Student.supervisors(student.id, (err, ss) => {
if (err) return reject(err);
return resolve(ss);
});
});
return [student, supervisors];
})
.spread((student, supervisors) => {
student.supervisors = supervisors;
console.log(JSON.stringify(supervisors));
console.log(JSON.stringify(student.supervisors));
return res.ok(student);
})
.catch(function (err) {
......
......@@ -105,6 +105,8 @@ module.exports = {
if (!supervisor.isSupAdmin && !stuSup)
throw new Error("Supervisor without students");
supervisor.isSup = true;
return res.ok({
user: supervisor,
server_time: (new Date()).getTime(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment