notification-issue (#72)
All checks were successful
Deploy FitLien services to Dev / Deploy to Dev (push) Successful in 4m29s
All checks were successful
Deploy FitLien services to Dev / Deploy to Dev (push) Successful in 4m29s
Reviewed-on: #72 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
3223efc392
commit
0a32e15d05
@ -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":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user