pushy

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-06-28 11:29:07 +08:00
parent 463a8d3978
commit 89acdfc239
67 changed files with 2736 additions and 306 deletions
+37 -4
View File
@@ -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',