diff --git a/functions/src/notifications/processNotification.ts b/functions/src/notifications/processNotification.ts index a9a5563..e952fb0 100644 --- a/functions/src/notifications/processNotification.ts +++ b/functions/src/notifications/processNotification.ts @@ -9,7 +9,6 @@ const logger = getLogger(); interface NotificationData { senderId?: string; recipientId?: string; - ownerId?: string; type?: string; notificationSent?: boolean; timestamp?: admin.firestore.FieldValue; @@ -83,9 +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.data?.userId) { targetUserId = notification.data.userId; logger.info(`Using data.userId: ${targetUserId}`); @@ -165,7 +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.read !== undefined) fcmData.read = String(notification.read); if (notification.data) { @@ -185,7 +180,7 @@ function prepareNotificationMessage( case "trainer_response": title = notification.data?.title || - (notification.data?.status === "ACCEPTED" + (notification.data?.status === "accepted" ? "Trainer Request Accepted" : "Trainer Request Update"); body = @@ -199,14 +194,14 @@ function prepareNotificationMessage( title = notification.data?.title || "New Client Assignment"; body = notification.data?.message || - `You have been assigned to ${notification.data?.name}`; + `You have been assigned to train ${notification.data?.name}.`; break; case "trainer_assigned_to_client": title = notification.data?.title || "Trainer Assigned"; body = notification.data?.message || - `${notification.data?.trainerName} has been assigned as your trainer`; + `${notification.data?.trainerName} has been assigned as your trainer.`; break; case "trainer_update_owner":