notification-bug-fix (#86)
All checks were successful
Deploy FitLien services to Dev / Deploy to Dev (push) Successful in 3m37s

Reviewed-on: #86
Reviewed-by: Dhansh A S <dhanshas@cosq.net>
Co-authored-by: Sharon Dcruz <sharondcruz@cosq.net>
Co-committed-by: Sharon Dcruz <sharondcruz@cosq.net>
This commit is contained in:
Sharon Dcruz 2025-08-14 08:35:40 +00:00 committed by Dhansh A S
parent c2914b16bb
commit d8ae223cce
2 changed files with 5 additions and 2 deletions

View File

@ -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()),

View File

@ -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 ||
`${