mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
add: more commits
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -35,7 +35,7 @@ const { onCourseCompleted } = require('../../services/achievements.service'
|
||||
const PendingCertificate = require('../../models/courses/pending_certificate.mdl');
|
||||
const Certificate = require('../../models/courses/certificate.mdl');
|
||||
const UserNotification = require('../../models/notifications/user_notification.mdl');
|
||||
const { NOTIFICATION_REGISTRY } = require('../../data/notifications.data');
|
||||
const { renderNotification } = require('../../services/notificationTemplate.service');
|
||||
|
||||
const notDeleted = { deletedAt: null };
|
||||
|
||||
@@ -956,10 +956,9 @@ exports.submitCourseAssessment = async (req, res) => {
|
||||
}
|
||||
|
||||
// Immediate notification: course completed, certificate incoming
|
||||
UserNotification.create({
|
||||
user_id,
|
||||
...NOTIFICATION_REGISTRY.course_completed.build({ courseTitle: course?.title ?? '', courseUuid: course?.uuid ?? null }),
|
||||
}).catch(err => console.error('[ASSESSMENT] Failed to emit course_completed notification:', err));
|
||||
renderNotification({ type: 'course_completed', data: { courseTitle: course?.title ?? '', courseUuid: course?.uuid ?? null } })
|
||||
.then(notify => UserNotification.create({ user_id, ...notify }))
|
||||
.catch(err => console.error('[ASSESSMENT] Failed to emit course_completed notification:', err));
|
||||
}
|
||||
|
||||
return R.success(res, "Assessment submitted.", {
|
||||
|
||||
Reference in New Issue
Block a user