feat(push): log push provider config status on startup
Print ✓/✗ for each platform (FCM/HMS/MI/OPPO/VIVO) so missing credentials are immediately visible in container logs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
155133a2d6
commit
bc48be1c95
|
|
@ -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 { DevicePushTokenRepository } from '../../infrastructure/repositories/device-push-token.repository';
|
||||||
import { DevicePushToken } from '../../domain/entities/device-push-token.entity';
|
import { DevicePushToken } from '../../domain/entities/device-push-token.entity';
|
||||||
import { PushProvider, PushMessage } from './push-providers/push-provider.interface';
|
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.
|
* Invalid tokens returned by providers are automatically deleted from DB.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OfflinePushService {
|
export class OfflinePushService implements OnModuleInit {
|
||||||
private readonly logger = new Logger(OfflinePushService.name);
|
private readonly logger = new Logger(OfflinePushService.name);
|
||||||
private readonly providers: Map<string, PushProvider>;
|
private readonly providers: Map<string, PushProvider>;
|
||||||
|
|
||||||
|
|
@ -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 {
|
sendForNotification(notification: NotificationForPush): void {
|
||||||
this._send(notification).catch((err) => {
|
this._send(notification).catch((err) => {
|
||||||
this.logger.error(`Offline push failed for ${notification.id}: ${err.message}`);
|
this.logger.error(`Offline push failed for ${notification.id}: ${err.message}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue