From d8ae223ccec4f60d924e4f9409cf8f0213dd7923 Mon Sep 17 00:00:00 2001 From: Sharon Dcruz Date: Thu, 14 Aug 2025 08:35:40 +0000 Subject: [PATCH] notification-bug-fix (#86) Reviewed-on: https://git.cosqnet.com/cosqnet/fitlien-services/pulls/86 Reviewed-by: Dhansh A S Co-authored-by: Sharon Dcruz Co-committed-by: Sharon Dcruz --- functions/src/notifications/membershipStatusNotifications.ts | 3 +++ functions/src/notifications/processNotification.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/src/notifications/membershipStatusNotifications.ts b/functions/src/notifications/membershipStatusNotifications.ts index 8d25206..2ed768f 100644 --- a/functions/src/notifications/membershipStatusNotifications.ts +++ b/functions/src/notifications/membershipStatusNotifications.ts @@ -4,6 +4,7 @@ import * as admin from "firebase-admin"; const app = getAdmin(); const logger = getLogger(); +const kTrainerRole = 'Trainer'; interface MembershipData { id?: string; @@ -545,6 +546,7 @@ async function sendTrainerNotifications( try { const trainerName = await getTrainerName(assignment.trainerId); const trainerUserId = await getTrainerUserId(assignment.trainerId); + const notifType = notificationType === "expired" @@ -588,6 +590,7 @@ async function sendTrainerNotifications( gymName, assignmentId: assignment.id, formattedExpiryDate: formattedDate, + role: kTrainerRole, expiryDate: expiryDate ? admin.firestore.Timestamp.fromDate(expiryDate) : admin.firestore.Timestamp.fromDate(new Date()), diff --git a/functions/src/notifications/processNotification.ts b/functions/src/notifications/processNotification.ts index d8edce7..fe7ce6a 100644 --- a/functions/src/notifications/processNotification.ts +++ b/functions/src/notifications/processNotification.ts @@ -181,8 +181,8 @@ function prepareNotificationMessage( title = notification.data?.title || (notification.data?.status === "accepted" - ? "Trainer Request Accepted" - : "Trainer Request Update"); + ? "Trainer Invitation Accepted" + : "Trainer Invitation Update"); body = notification.data?.message || `${