mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -14,7 +14,7 @@ const { Task, TaskList, TaskRequirement, TaskListGroup, mdl_UserGroups } = requi
|
||||
const { mdl_UserGroupMembers } = require('../../models/users/user_groups.mdl');
|
||||
const mdl_Users = require('../../models/users/users.mdl');
|
||||
const UserNotification = require('../../models/notifications/user_notification.mdl');
|
||||
const { renderNotification } = require('../../services/notificationTemplate.service');
|
||||
const { NOTIFICATION_REGISTRY } = require('../../data/notifications.data');
|
||||
const { adminExclude, jsonbSchemas, computedAttributes } = require('../../models/task/task.attributes');
|
||||
|
||||
const R = require('../../utils/response.util');
|
||||
@@ -439,10 +439,10 @@ exports.assignGroups = async (req, res) => {
|
||||
|
||||
if (userIds.length) {
|
||||
const now = new Date();
|
||||
const notify = await renderNotification({ type: 'task_assigned', data: {
|
||||
const notify = NOTIFICATION_REGISTRY.task_assigned.build({
|
||||
taskListName: taskList.name,
|
||||
taskCount,
|
||||
} });
|
||||
});
|
||||
await UserNotification.bulkCreate(
|
||||
userIds.map((user_id) => ({ user_id, ...notify, seen: false, createdAt: now, updatedAt: now })),
|
||||
{ validate: false }
|
||||
@@ -763,11 +763,11 @@ exports.updateTask = async (req, res) => {
|
||||
const now = new Date();
|
||||
// Title/message are identical for every member — render once,
|
||||
// then vary only the per-member groupId in the data payload.
|
||||
const notify = await renderNotification({ type: 'task_requirements_updated', data: {
|
||||
const notify = NOTIFICATION_REGISTRY.task_requirements_updated.build({
|
||||
taskName: full.name,
|
||||
taskListId: task.task_list_id,
|
||||
groupId: null,
|
||||
} });
|
||||
});
|
||||
await UserNotification.bulkCreate(
|
||||
members.map(({ user_id, group_id }) => ({
|
||||
user_id,
|
||||
|
||||
Reference in New Issue
Block a user