notification email on student unlinking

parent 1457e190
Showing with 15 additions and 10 deletions
...@@ -475,6 +475,9 @@ module.exports = { ...@@ -475,6 +475,9 @@ module.exports = {
}) })
.spread((stuSup, student) => { .spread((stuSup, student) => {
if (!student)
throw new Error("Student not found");
// //
// Remove relationship // Remove relationship
// //
...@@ -486,19 +489,21 @@ module.exports = { ...@@ -486,19 +489,21 @@ module.exports = {
// //
student = student.toJSON(); student = student.toJSON();
if (student.license && student.license.number) { if (student.license && student.license.number) {
var message = sails.__(
{
phrase: 'student_unlinked',
locale: supervisor.lang
},
{
name: student.name,
surname: student.surname,
license: student.license.number
});
console.log("-->" + message);
mailService.mailer() mailService.mailer()
.send({ .send({
to: supervisor.email, to: supervisor.email,
text: sails.__( text: message
{
phrase: 'student_unlinked',
locale: supervisor.lang
},
{
name: student.name,
surname: student.surname,
license: student.license.number
})
}) })
.then(() => {}) .then(() => {})
.catch((err) => {}); .catch((err) => {});
......
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