notification-bug-fix (#86)
All checks were successful
Deploy FitLien services to Dev / Deploy to Dev (push) Successful in 3m37s
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:
parent
c2914b16bb
commit
d8ae223cce
@ -4,6 +4,7 @@ import * as admin from "firebase-admin";
|
|||||||
|
|
||||||
const app = getAdmin();
|
const app = getAdmin();
|
||||||
const logger = getLogger();
|
const logger = getLogger();
|
||||||
|
const kTrainerRole = 'Trainer';
|
||||||
|
|
||||||
interface MembershipData {
|
interface MembershipData {
|
||||||
id?: string;
|
id?: string;
|
||||||
@ -546,6 +547,7 @@ async function sendTrainerNotifications(
|
|||||||
const trainerName = await getTrainerName(assignment.trainerId);
|
const trainerName = await getTrainerName(assignment.trainerId);
|
||||||
const trainerUserId = await getTrainerUserId(assignment.trainerId);
|
const trainerUserId = await getTrainerUserId(assignment.trainerId);
|
||||||
|
|
||||||
|
|
||||||
const notifType =
|
const notifType =
|
||||||
notificationType === "expired"
|
notificationType === "expired"
|
||||||
? "trainer_client_plan_expired"
|
? "trainer_client_plan_expired"
|
||||||
@ -588,6 +590,7 @@ async function sendTrainerNotifications(
|
|||||||
gymName,
|
gymName,
|
||||||
assignmentId: assignment.id,
|
assignmentId: assignment.id,
|
||||||
formattedExpiryDate: formattedDate,
|
formattedExpiryDate: formattedDate,
|
||||||
|
role: kTrainerRole,
|
||||||
expiryDate: expiryDate
|
expiryDate: expiryDate
|
||||||
? admin.firestore.Timestamp.fromDate(expiryDate)
|
? admin.firestore.Timestamp.fromDate(expiryDate)
|
||||||
: admin.firestore.Timestamp.fromDate(new Date()),
|
: admin.firestore.Timestamp.fromDate(new Date()),
|
||||||
|
|||||||
@ -181,8 +181,8 @@ function prepareNotificationMessage(
|
|||||||
title =
|
title =
|
||||||
notification.data?.title ||
|
notification.data?.title ||
|
||||||
(notification.data?.status === "accepted"
|
(notification.data?.status === "accepted"
|
||||||
? "Trainer Request Accepted"
|
? "Trainer Invitation Accepted"
|
||||||
: "Trainer Request Update");
|
: "Trainer Invitation Update");
|
||||||
body =
|
body =
|
||||||
notification.data?.message ||
|
notification.data?.message ||
|
||||||
`${
|
`${
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user