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
@@ -11,10 +11,10 @@ exports.getNotificationTemplates = async (req, res) => {
const templates = await mdl_NotificationTemplate.findAll({
order: [['notify_type', 'ASC'], ['type', 'ASC']],
});
return R.success(res, 'Notification templates retrieved.', templates);
return R.success(res, 'Announcement templates retrieved.', templates);
} catch (err) {
console.error('[ADMIN][GET NOTIFICATION TEMPLATES]', err);
return R.error(res, 'Could not retrieve notification templates.', 500);
return R.error(res, 'Could not retrieve announcement templates.', 500);
}
};
@@ -23,11 +23,11 @@ exports.getNotificationTemplates = async (req, res) => {
exports.getNotificationTemplate = async (req, res) => {
try {
const template = await mdl_NotificationTemplate.findByPk(req.params.id);
if (!template) return R.error(res, 'Notification template not found.', 404);
return R.success(res, 'Notification template retrieved.', template);
if (!template) return R.error(res, 'Announcement template not found.', 404);
return R.success(res, 'Announcement template retrieved.', template);
} catch (err) {
console.error('[ADMIN][GET NOTIFICATION TEMPLATE]', err);
return R.error(res, 'Could not retrieve notification template.', 500);
return R.error(res, 'Could not retrieve announcement template.', 500);
}
};
@@ -39,7 +39,7 @@ exports.getNotificationTemplate = async (req, res) => {
exports.updateNotificationTemplate = async (req, res) => {
try {
const template = await mdl_NotificationTemplate.findByPk(req.params.id);
if (!template) return R.error(res, 'Notification template not found.', 404);
if (!template) return R.error(res, 'Announcement template not found.', 404);
const { label, title, message, publish } = req.body;
@@ -74,9 +74,9 @@ exports.updateNotificationTemplate = async (req, res) => {
logActivity(req.user?.user_id, 'update_notification_template', { entityType: 'notification_template', entityId: template.notification_template_id, details: { type: template.type, published: isPublishing } });
return R.success(res, 'Notification template updated.', template);
return R.success(res, 'Announcement template updated.', template);
} catch (err) {
console.error('[ADMIN][UPDATE NOTIFICATION TEMPLATE]', err);
return R.error(res, 'Could not update notification template.', 500);
return R.error(res, 'Could not update announcement template.', 500);
}
};