Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ model User {
initiatedBackups DatabaseBackup[] @relation("BackupInitiatedBy")
restoredBackups DatabaseBackup[] @relation("BackupRestoredBy")
emailStatus EmailStatus @default(ACTIVE) @map("email_status")
fcmToken String? @map("fcm_token")
notifications Notification[]
linkClicks LinkClick[]
emailEngagements EmailEngagement[]
Expand Down
6 changes: 6 additions & 0 deletions src/notifications/notifications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ export class NotificationsService {
});

// 2. Try real-time delivery
// FCM Push Integration
const user = await this.prisma.user.findUnique({ where: { id: userId }, select: { fcmToken: true } });
if (user?.fcmToken) {
console.log(Sending FCM notification to token: \);
// In production, use admin.messaging().send() here
}
const delivered = this.gateway.sendToUser(userId, 'notification', notification);

if (delivered) {
Expand Down
Loading