From ca08d83f987b98db9eef2e966224c5373481bab1 Mon Sep 17 00:00:00 2001 From: Sharon Dcruz Date: Tue, 29 Jul 2025 13:50:50 +0000 Subject: [PATCH] notification-issue (#73) PLan Expiry Notification added Reviewed-on: https://git.cosqnet.com/cosqnet/fitlien-services/pulls/73 Reviewed-by: Dhansh A S Co-authored-by: Sharon Dcruz Co-committed-by: Sharon Dcruz --- firestore.indexes.json | 36 +++++++++++++++++++ .../src/notifications/processNotification.ts | 7 ++++ 2 files changed, 43 insertions(+) diff --git a/firestore.indexes.json b/firestore.indexes.json index 5609cde..def7a3d 100644 --- a/firestore.indexes.json +++ b/firestore.indexes.json @@ -166,6 +166,42 @@ } ] }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "data.ownerId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + }, + { + "fieldPath": "__name__", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "data.trainerId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + }, + { + "fieldPath": "__name__", + "order": "DESCENDING" + } + ] + }, { "collectionGroup": "workout_logs", "queryScope": "COLLECTION", diff --git a/functions/src/notifications/processNotification.ts b/functions/src/notifications/processNotification.ts index e952fb0..5d3c9b0 100644 --- a/functions/src/notifications/processNotification.ts +++ b/functions/src/notifications/processNotification.ts @@ -236,6 +236,13 @@ function prepareNotificationMessage( `You have been assigned ${notification.data?.subscriptionName} at ${notification.data?.gymName}`; break; + case "plan_expired": + title = notification.data?.title || "Plan Expired"; + body = + notification.data?.message || + `The plan ${notification.data?.planName} for client ${notification.data?.clientName} expired on ${notification.data?.formattedExpiryDate}.`; + break; + case "schedule_update": title = notification.data?.title || "Schedule Update"; body =