Changes Updated

This commit is contained in:
Sharon Dcruz 2025-07-29 13:13:11 +05:30
parent f1cd88a7c5
commit e7515d7d3a

View File

@ -9,8 +9,6 @@ const logger = getLogger();
interface NotificationData {
senderId?: string;
recipientId?: string;
ownerId?: string;
trainerId?: string;
type?: string;
notificationSent?: boolean;
timestamp?: admin.firestore.FieldValue;
@ -84,14 +82,6 @@ async function getUserAndFCMToken(
if (notification.recipientId) {
targetUserId = notification.recipientId;
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) {
targetUserId = notification.data.userId;
logger.info(`Using data.userId: ${targetUserId}`);
@ -171,8 +161,6 @@ function prepareNotificationMessage(
if (notification.senderId) fcmData.senderId = notification.senderId;
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.data) {