Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /**
* Queue Types
*
* Type definitions for email queue jobs and results.
*/
/**
* Email priority levels
*/
export type EmailPriority = 'high' | 'normal' | 'low';
/**
* Email job data structure
*/
export interface EmailJobData {
/** Recipient email address */
to: string;
/** Email subject */
subject: string;
/** Template name (e.g., 'order-confirmation', 'password-reset') */
template: string;
/** Template data for rendering */
data: Record<string, unknown>;
/** Associated user ID for tracking */
userId?: number;
/** Email priority */
priority?: EmailPriority;
/** Optional delay before sending (milliseconds) */
delay?: number;
/** Scheduled send time */
scheduledFor?: Date;
/** Pre-rendered HTML (optional, bypasses template rendering) */
html?: string;
}
/**
* Email job result after processing
*/
export interface EmailJobResult {
/** Email provider message ID */
messageId: string;
/** Send status */
status: 'sent' | 'failed';
/** Error message if failed */
error?: string;
/** Timestamp when sent */
sentAt: Date;
}
/**
* Queue statistics
*/
export interface QueueStats {
/** Jobs waiting to be processed */
waiting: number;
/** Jobs currently being processed */
active: number;
/** Successfully completed jobs */
completed: number;
/** Failed jobs */
failed: number;
/** Delayed jobs */
delayed: number;
/** Paused status */
paused: boolean;
}
/**
* Email log status (matches Prisma enum)
*/
export type EmailStatus =
| 'PENDING'
| 'QUEUED'
| 'SENT'
| 'DELIVERED'
| 'OPENED'
| 'CLICKED'
| 'BOUNCED'
| 'FAILED';
/**
* Priority mapping for BullMQ
* Lower number = higher priority
*/
export const priorityMap: Record<EmailPriority, number> = {
high: 1,
normal: 5,
low: 10,
};
|