notification-issue #72

Merged
dhanshas merged 7 commits from notification-issue into dev 2025-07-29 07:46:19 +00:00
Showing only changes of commit e7515d7d3a - Show all commits

View File

@ -9,8 +9,6 @@ const logger = getLogger();
interface NotificationData { interface NotificationData {
senderId?: string; senderId?: string;
recipientId?: string; recipientId?: string;
ownerId?: string;
trainerId?: string;
type?: string; type?: string;
notificationSent?: boolean; notificationSent?: boolean;
timestamp?: admin.firestore.FieldValue; timestamp?: admin.firestore.FieldValue;
@ -84,14 +82,6 @@ async function getUserAndFCMToken(
if (notification.recipientId) { if (notification.recipientId) {
targetUserId = notification.recipientId; targetUserId = notification.recipientId;
logger.info(`Using top-level recipientId: ${targetUserId}`); logger.info(`Using top-level recipientId: ${targetUserId}`);
} else if (notification.ownerId) {
targetUserId = notification.ownerId;
logger.info(`Using top-level ownerId: ${targetUserId}`);
} else if (notification.trainerId) {
targetUserId = notification.trainerId;
logger.info(`Using top-level trainerId: ${targetUserId}`);
} else if (notification.data?.userId) { } else if (notification.data?.userId) {
targetUserId = notification.data.userId; targetUserId = notification.data.userId;
logger.info(`Using data.userId: ${targetUserId}`); logger.info(`Using data.userId: ${targetUserId}`);
@ -171,8 +161,6 @@ function prepareNotificationMessage(
if (notification.senderId) fcmData.senderId = notification.senderId; if (notification.senderId) fcmData.senderId = notification.senderId;
if (notification.recipientId) fcmData.recipientId = notification.recipientId; if (notification.recipientId) fcmData.recipientId = notification.recipientId;
if (notification.ownerId) fcmData.ownerId = notification.ownerId;
if (notification.trainerId) fcmData.trainerId = notification.trainerId;
if (notification.read !== undefined) fcmData.read = String(notification.read); if (notification.read !== undefined) fcmData.read = String(notification.read);
if (notification.data) { if (notification.data) {