template-saas/apps/backend/dist/modules/notifications/services/notification-queue.service.d.ts
rckrdmrd 50a821a415
Some checks failed
CI / Backend CI (push) Has been cancelled
CI / Frontend CI (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / CI Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones de configuracion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:08 -06:00

40 lines
1.8 KiB
TypeScript

import { Repository } from 'typeorm';
import { NotificationQueue, NotificationLog, Notification, NotificationChannel } from '../entities';
export interface QueueItem {
id: string;
notification_id: string;
channel: NotificationChannel;
priority_value: number;
attempts: number;
notification: Notification;
}
export interface QueueStats {
queued: number;
processing: number;
sent: number;
failed: number;
retrying: number;
}
export declare class NotificationQueueService {
private readonly queueRepository;
private readonly logRepository;
private readonly notificationRepository;
private readonly logger;
constructor(queueRepository: Repository<NotificationQueue>, logRepository: Repository<NotificationLog>, notificationRepository: Repository<Notification>);
enqueue(notificationId: string, channel: NotificationChannel, priority?: 'low' | 'normal' | 'high' | 'urgent', scheduledFor?: Date): Promise<NotificationQueue>;
enqueueBatch(notificationId: string, channels: NotificationChannel[], priority?: 'low' | 'normal' | 'high' | 'urgent'): Promise<NotificationQueue[]>;
getPendingItems(limit?: number, channel?: NotificationChannel): Promise<QueueItem[]>;
markAsProcessing(queueId: string): Promise<void>;
markAsSent(queueId: string, provider?: string, providerMessageId?: string, providerResponse?: Record<string, any>): Promise<void>;
markAsFailed(queueId: string, errorMessage: string, provider?: string): Promise<void>;
getStats(): Promise<QueueStats>;
getStatsByChannel(): Promise<Array<{
channel: string;
status: string;
count: number;
}>>;
cleanupOldItems(daysToKeep?: number): Promise<number>;
cancelPending(notificationId: string): Promise<number>;
private getPriorityValue;
}