mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -31,6 +31,7 @@ const notDeleted = { deletedAt: null };
|
||||
async function applyBroadcastFields(broadcast, body) {
|
||||
if (body.title !== undefined) broadcast.title = body.title;
|
||||
if (body.message !== undefined) broadcast.message = body.message;
|
||||
if (body.link_url !== undefined) broadcast.link_url = body.link_url?.trim() || null;
|
||||
|
||||
if (body.show_in_sticky !== undefined) broadcast.show_in_sticky = !!body.show_in_sticky;
|
||||
if (body.show_in_notifications !== undefined) broadcast.show_in_notifications = !!body.show_in_notifications;
|
||||
@@ -159,6 +160,7 @@ exports.createBroadcast = async (req, res) => {
|
||||
const {
|
||||
title,
|
||||
message,
|
||||
link_url,
|
||||
target_type,
|
||||
target_id,
|
||||
createdBy,
|
||||
@@ -186,6 +188,7 @@ exports.createBroadcast = async (req, res) => {
|
||||
const broadcast = await NotificationBroadcast.build({
|
||||
title,
|
||||
message,
|
||||
link_url: link_url?.trim() || null,
|
||||
createdBy,
|
||||
status: 'draft',
|
||||
target_type,
|
||||
@@ -272,6 +275,7 @@ exports.sendBroadcast = async (req, res) => {
|
||||
message: broadcast.message,
|
||||
targetType,
|
||||
targetId,
|
||||
linkUrl: broadcast.link_url,
|
||||
});
|
||||
|
||||
if (targetType === 'admin' || targetType === 'both') {
|
||||
@@ -308,6 +312,7 @@ exports.sendBroadcast = async (req, res) => {
|
||||
? NOTIFICATION_REGISTRY.broadcast.build({
|
||||
title: broadcast.title, message: broadcast.message, targetType, targetId,
|
||||
groupId: groupByUser[user_id] ?? null,
|
||||
linkUrl: broadcast.link_url,
|
||||
})
|
||||
: baseNotify),
|
||||
seen: false,
|
||||
|
||||
Reference in New Issue
Block a user