units,lesson as standalone

This commit is contained in:
2026-07-10 11:44:46 +08:00
parent 86fba50b95
commit e1ffdab190
46 changed files with 1463 additions and 197 deletions
@@ -0,0 +1,42 @@
'use strict';
// Part 1A/1C — new learner-facing notification types for the task review
// workflow, group assignment, and per-task completion. Seeded already-published
// (status: 'sent') like every other is_system row in the original
// 20260703000008 migration, so the trigger call sites work immediately without
// requiring an admin to publish them first.
module.exports = {
async up(queryInterface) {
const now = new Date();
await queryInterface.bulkInsert('notification_templates', [
{
type: 'task_submission_reviewed', notify_type: 'task', scope: 'user', is_system: true,
label: 'Task Submission Reviewed', status: 'sent',
title: 'Submission Reviewed',
message: 'Your submission for "{{taskName}}" was {{statusLabel}}.{{reviewNoteSuffix}}',
createdAt: now, updatedAt: now,
},
{
type: 'task_assigned', notify_type: 'task', scope: 'user', is_system: true,
label: 'Task List Assigned', status: 'sent',
title: 'New Task Assigned',
message: 'You have been assigned "{{taskListName}}" — {{taskCount}} task(s) to complete.',
createdAt: now, updatedAt: now,
},
{
type: 'task_completed', notify_type: 'task', scope: 'user', is_system: true,
label: 'Task Completed', status: 'sent',
title: 'Task Completed',
message: 'You completed "{{taskName}}".',
createdAt: now, updatedAt: now,
},
]);
},
async down(queryInterface) {
await queryInterface.bulkDelete('notification_templates', {
type: ['task_submission_reviewed', 'task_assigned', 'task_completed'],
});
},
};