diff --git a/src/modules/notifications/services/najva-push.service.ts b/src/modules/notifications/services/najva-push.service.ts index a4ce021..a3071d9 100644 --- a/src/modules/notifications/services/najva-push.service.ts +++ b/src/modules/notifications/services/najva-push.service.ts @@ -18,7 +18,7 @@ export class NajvaPushService { //=============================================== - async sendPushNotification(tokens: string[], message: INajvaNotificationMessage): Promise { + async sendPushNotification(tokens: string[], message: INajvaNotificationMessage) { if (!tokens || tokens.length === 0) { this.logger.warn("No tokens provided for push notification"); return null; @@ -100,7 +100,7 @@ export class NajvaPushService { } //=============================================== - async sendNotificationToUser(userToken: string, message: INajvaNotificationMessage): Promise { + async sendNotificationToUser(userToken: string, message: INajvaNotificationMessage) { try { const result = await this.sendPushNotification([userToken], message); @@ -117,7 +117,7 @@ export class NajvaPushService { } //=============================================== - async sendNotificationToMultipleUsers(userTokens: string[], message: INajvaNotificationMessage): Promise<{ success: number; failed: number }> { + async sendNotificationToMultipleUsers(userTokens: string[], message: INajvaNotificationMessage) { try { const result = await this.sendPushNotification(userTokens, message); diff --git a/src/modules/notifications/services/notifications.service.ts b/src/modules/notifications/services/notifications.service.ts index c11c1b5..2716988 100755 --- a/src/modules/notifications/services/notifications.service.ts +++ b/src/modules/notifications/services/notifications.service.ts @@ -72,10 +72,9 @@ export class NotificationsService { ...createNotificationDto, recipient: user, }); - // + await em.persistAndFlush(notification); - // Send push notification if user has a push token if (user.pushToken) { await this.sendPushNotificationToUser(user.pushToken, { title: createNotificationDto.title, @@ -92,13 +91,13 @@ export class NotificationsService { //=============================================== - async sendPushNotificationToUser(userToken: string, message: INajvaNotificationMessage): Promise { + async sendPushNotificationToUser(userToken: string, message: INajvaNotificationMessage) { return this.najvaPushService.sendNotificationToUser(userToken, message); } //=============================================== - async sendPushNotificationToMultipleUsers(userTokens: string[], message: INajvaNotificationMessage): Promise<{ success: number; failed: number }> { + async sendPushNotificationToMultipleUsers(userTokens: string[], message: INajvaNotificationMessage) { return this.najvaPushService.sendNotificationToMultipleUsers(userTokens, message); }