mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -19,15 +19,18 @@
|
||||
* No other changes needed.
|
||||
*
|
||||
* Current types:
|
||||
* Admin : task_overdue
|
||||
* Admin : task_overdue, user_registration, nogrp_user_registered
|
||||
* User : user_task_overdue, achievement, course_unlocked,
|
||||
* course_completed, certificate_issued, task_reminder, announcement
|
||||
* course_completed, certificate_issued, task_reminder, announcement,
|
||||
* nogrp_welcome
|
||||
*
|
||||
* Author: Kenneth Obsequio (@lash0000)
|
||||
* Date Created: Jun. 19, 2026
|
||||
***********************************************************************************************************************************************************************/
|
||||
'use strict';
|
||||
|
||||
const { fmtDate } = require('../utils/datetime.util');
|
||||
|
||||
const NOTIFICATION_REGISTRY = {
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
@@ -64,6 +67,21 @@ const NOTIFICATION_REGISTRY = {
|
||||
},
|
||||
},
|
||||
|
||||
// ── Unaffiliated User Registration ───────────────────────────────────────
|
||||
nogrp_user_registered: {
|
||||
type: 'nogrp_user_registered',
|
||||
scope: 'admin',
|
||||
trigger: 'event',
|
||||
build({ userEmail, regType }) {
|
||||
return {
|
||||
type: 'nogrp_user_registered',
|
||||
title: 'New Unaffiliated User',
|
||||
message: `A new user (${userEmail}) registered via ${regType} without a group code and was placed in the default group.`,
|
||||
data: { userEmail, regType },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// USER notifications (scope: 'user')
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
@@ -92,7 +110,7 @@ const NOTIFICATION_REGISTRY = {
|
||||
return {
|
||||
type: 'task',
|
||||
title: 'Task Deadline Approaching',
|
||||
message: `"${taskName}" is due on ${new Date(deadline).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}.`,
|
||||
message: `"${taskName}" is due on ${fmtDate(deadline)}.`,
|
||||
data: { taskName, deadline },
|
||||
};
|
||||
},
|
||||
@@ -136,7 +154,7 @@ const NOTIFICATION_REGISTRY = {
|
||||
return {
|
||||
type: 'course',
|
||||
title: 'Course Completed',
|
||||
message: `Great job! You've completed "${courseTitle}". Your certificate is being prepared and will be ready in about 5 minutes.`,
|
||||
message: `Great job! You've completed "${courseTitle}". Your certificate will be issued within the next hour.`,
|
||||
data: { courseTitle },
|
||||
};
|
||||
},
|
||||
@@ -176,6 +194,21 @@ const NOTIFICATION_REGISTRY = {
|
||||
},
|
||||
},
|
||||
|
||||
// ── No-Group Welcome ──────────────────────────────────────────────────────
|
||||
nogrp_welcome: {
|
||||
type: 'announcement',
|
||||
scope: 'user',
|
||||
trigger: 'event',
|
||||
build() {
|
||||
return {
|
||||
type: 'announcement',
|
||||
title: "You're Not in a Group Yet",
|
||||
message: 'You are currently in the default group. Contact an administrator to be assigned to your team.',
|
||||
data: { groupCode: 'NOGRP' },
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
// ── Assessment ────────────────────────────────────────────────────────────
|
||||
assessment_updated: {
|
||||
type: 'assessment',
|
||||
|
||||
Reference in New Issue
Block a user