diff --git a/packages/services/notification-service/src/application/services/offline-push.service.ts b/packages/services/notification-service/src/application/services/offline-push.service.ts index c08ea74..8219fbc 100644 --- a/packages/services/notification-service/src/application/services/offline-push.service.ts +++ b/packages/services/notification-service/src/application/services/offline-push.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Logger } from '@nestjs/common'; +import { Injectable, Logger, OnModuleInit } from '@nestjs/common'; import { DevicePushTokenRepository } from '../../infrastructure/repositories/device-push-token.repository'; import { DevicePushToken } from '../../domain/entities/device-push-token.entity'; import { PushProvider, PushMessage } from './push-providers/push-provider.interface'; @@ -33,7 +33,7 @@ export interface NotificationForPush { * Invalid tokens returned by providers are automatically deleted from DB. */ @Injectable() -export class OfflinePushService { +export class OfflinePushService implements OnModuleInit { private readonly logger = new Logger(OfflinePushService.name); private readonly providers: Map; @@ -54,6 +54,16 @@ export class OfflinePushService { ]); } + onModuleInit(): void { + for (const [platform, provider] of this.providers) { + if (provider.isConfigured()) { + this.logger.log(`[Push] ${platform} ✓ configured`); + } else { + this.logger.warn(`[Push] ${platform} ✗ NOT configured (credentials missing)`); + } + } + } + sendForNotification(notification: NotificationForPush): void { this._send(notification).catch((err) => { this.logger.error(`Offline push failed for ${notification.id}: ${err.message}`);