- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8 - Actualizaciones de configuracion Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { OnModuleInit } from '@nestjs/common';
|
|
import { ConfigService } from '@nestjs/config';
|
|
import { Repository } from 'typeorm';
|
|
import { UserDevice, NotificationLog } from '../entities';
|
|
export interface PushPayload {
|
|
title: string;
|
|
body: string;
|
|
icon?: string;
|
|
badge?: string;
|
|
url?: string;
|
|
data?: Record<string, any>;
|
|
actions?: Array<{
|
|
action: string;
|
|
title: string;
|
|
}>;
|
|
}
|
|
export interface SendResult {
|
|
deviceId: string;
|
|
success: boolean;
|
|
error?: string;
|
|
statusCode?: number;
|
|
}
|
|
export declare class PushNotificationService implements OnModuleInit {
|
|
private readonly configService;
|
|
private readonly deviceRepository;
|
|
private readonly logRepository;
|
|
private readonly logger;
|
|
private isConfigured;
|
|
constructor(configService: ConfigService, deviceRepository: Repository<UserDevice>, logRepository: Repository<NotificationLog>);
|
|
onModuleInit(): void;
|
|
isEnabled(): boolean;
|
|
getVapidPublicKey(): string | null;
|
|
sendToUser(userId: string, tenantId: string, payload: PushPayload, notificationId?: string): Promise<SendResult[]>;
|
|
sendToDevice(device: UserDevice, payload: string, notificationId?: string): Promise<SendResult>;
|
|
sendBroadcast(tenantId: string, payload: PushPayload): Promise<{
|
|
total: number;
|
|
successful: number;
|
|
failed: number;
|
|
}>;
|
|
validateSubscription(subscriptionJson: string): boolean;
|
|
}
|