chore: remove webhook system
This commit is contained in:
@@ -39,6 +39,8 @@ export type WebSocketNamespace = (typeof WEBSOCKET_NAMESPACES)[keyof typeof WEBS
|
||||
|
||||
export const EMAIL_QUEUE_CONSTANTS = {
|
||||
EMAIL_QUEUE: "email_queue",
|
||||
EMAIL_POLLING_QUEUE: "email_polling_queue",
|
||||
EMAIL_POLLING_JOB: "email_polling_job",
|
||||
EMAIL_BULK_ACTION_QUEUE: "email_bulk_action_queue",
|
||||
EMAIL_BULK_ACTION_SEEN_ALL: "email_bulk_action_seen_all",
|
||||
EMAIL_BULK_ACTION_EMPTY_TRASH: "email_bulk_action_empty_trash",
|
||||
@@ -50,8 +52,10 @@ export const EMAIL_QUEUE_CONSTANTS = {
|
||||
EMAIL_BULK_ACTION_BACKOFF_DELAY: 2000, // 2 seconds
|
||||
EMAIL_BULK_ACTION_PRIORITY: 1,
|
||||
//
|
||||
EMAIL_QUEUE_PROCESSING: "email_queue_processing",
|
||||
EMAIL_SCHEDULER_JOB: "email_monitoring_scheduler",
|
||||
EMAIL_MONITORING_ACTION_NAME: "schedule_email_monitoring",
|
||||
EMAIL_MONITORING_JOB_PATTERN: "*/5 * * * * *", // Every 5 seconds
|
||||
EMAIL_POLLING_INTERVAL: 30000, // 30 seconds
|
||||
EMAIL_POLLING_REMOVE_ON_COMPLETE: 5, // Keep last 5 completed jobs
|
||||
EMAIL_POLLING_REMOVE_ON_FAIL: 10, // Keep last 10 failed jobs
|
||||
EMAIL_POLLING_ATTEMPTS: 3, // Retry failed jobs 3 times
|
||||
EMAIL_POLLING_BACKOFF_DELAY: 2000, // 2 seconds
|
||||
EMAIL_POLLING_PRIORITY: 1,
|
||||
} as const;
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
import { EMAIL_QUEUE_CONSTANTS } from "../constants/email-events.constant";
|
||||
|
||||
// Base interface with common properties
|
||||
export interface BaseEventPayload {
|
||||
export interface IBaseEventPayload {
|
||||
userId: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
// Base interface for message-related events
|
||||
export interface BaseMessageEventPayload extends BaseEventPayload {
|
||||
export interface IBaseMessageEventPayload extends IBaseEventPayload {
|
||||
messageId: number;
|
||||
}
|
||||
|
||||
// Base interface for mailbox-related events
|
||||
export interface BaseMailboxEventPayload extends BaseEventPayload {
|
||||
export interface IBaseMailboxEventPayload extends IBaseEventPayload {
|
||||
mailboxId: string;
|
||||
}
|
||||
|
||||
// Base interface for message events that also involve mailboxes
|
||||
export interface BaseMessageMailboxEventPayload extends BaseMessageEventPayload {
|
||||
export interface IBaseMessageMailboxEventPayload extends IBaseMessageEventPayload {
|
||||
mailboxId: string;
|
||||
}
|
||||
|
||||
// Specific email event interfaces
|
||||
export interface EmailPayload extends BaseMessageMailboxEventPayload {
|
||||
export interface IEmailPayload extends IBaseMessageMailboxEventPayload {
|
||||
wildduckUserId: string;
|
||||
userId: string;
|
||||
messageId: number;
|
||||
date: string;
|
||||
from: {
|
||||
name?: string;
|
||||
address: string;
|
||||
@@ -38,18 +40,18 @@ export interface EmailPayload extends BaseMessageMailboxEventPayload {
|
||||
isRead: boolean;
|
||||
}
|
||||
|
||||
export type EmailStatusPayload = BaseMessageMailboxEventPayload;
|
||||
export type IEmailStatusPayload = IBaseMessageMailboxEventPayload;
|
||||
|
||||
export interface EmailMovePayload extends BaseMessageEventPayload {
|
||||
export interface IEmailMovePayload extends IBaseMessageEventPayload {
|
||||
fromMailboxId: string;
|
||||
toMailboxId: string;
|
||||
fromMailboxName: string;
|
||||
toMailboxName: string;
|
||||
}
|
||||
|
||||
export type EmailDeletePayload = BaseMessageMailboxEventPayload;
|
||||
export type IEmailDeletePayload = IBaseMessageMailboxEventPayload;
|
||||
|
||||
export interface EmailSentPayload extends BaseMessageMailboxEventPayload {
|
||||
export interface IEmailSentPayload extends IBaseMessageMailboxEventPayload {
|
||||
from: {
|
||||
name?: string;
|
||||
address: string;
|
||||
@@ -64,30 +66,30 @@ export interface EmailSentPayload extends BaseMessageMailboxEventPayload {
|
||||
isRead: boolean;
|
||||
}
|
||||
|
||||
export interface MailboxUpdatePayload extends BaseMailboxEventPayload {
|
||||
export interface IMailboxUpdatePayload extends IBaseMailboxEventPayload {
|
||||
mailboxName: string;
|
||||
unreadCount: number;
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
export interface UnreadCountPayload extends BaseEventPayload {
|
||||
export interface IUnreadCountPayload extends IBaseEventPayload {
|
||||
totalUnread: number;
|
||||
mailboxCounts: Record<string, number>;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface EmailWebSocketEvents {
|
||||
export interface IEmailWebSocketEvents {
|
||||
// Server to Client events
|
||||
new_email: EmailPayload;
|
||||
email_read: EmailStatusPayload;
|
||||
email_unread: EmailStatusPayload;
|
||||
email_flagged: EmailStatusPayload;
|
||||
email_unflagged: EmailStatusPayload;
|
||||
email_deleted: EmailDeletePayload;
|
||||
email_moved: EmailMovePayload;
|
||||
email_sent: EmailSentPayload;
|
||||
mailbox_updated: MailboxUpdatePayload;
|
||||
unread_count_updated: UnreadCountPayload;
|
||||
new_email: IEmailPayload;
|
||||
email_read: IEmailStatusPayload;
|
||||
email_unread: IEmailStatusPayload;
|
||||
email_flagged: IEmailStatusPayload;
|
||||
email_unflagged: IEmailStatusPayload;
|
||||
email_deleted: IEmailDeletePayload;
|
||||
email_moved: IEmailMovePayload;
|
||||
email_sent: IEmailSentPayload;
|
||||
mailbox_updated: IMailboxUpdatePayload;
|
||||
unread_count_updated: IUnreadCountPayload;
|
||||
|
||||
// Connection events
|
||||
connection_established: { userId: string; timestamp: string };
|
||||
@@ -98,18 +100,7 @@ export interface EmailWebSocketEvents {
|
||||
pong: { timestamp: string };
|
||||
}
|
||||
|
||||
export interface EmailMonitoringJob {
|
||||
userId: string;
|
||||
wildduckUserId?: string;
|
||||
lastCheckTimestamp?: Date;
|
||||
}
|
||||
|
||||
export interface EmailSchedulerJob {
|
||||
action: typeof EMAIL_QUEUE_CONSTANTS.EMAIL_MONITORING_ACTION_NAME;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface NewEmailData {
|
||||
export interface INewEmailData {
|
||||
userId: string;
|
||||
messageId: number;
|
||||
wildduckUserId: string;
|
||||
@@ -117,7 +108,7 @@ export interface NewEmailData {
|
||||
}
|
||||
|
||||
// Helper interfaces for notification service parameters
|
||||
export interface EmailSentNotificationParams {
|
||||
export interface IEmailSentNotificationParams {
|
||||
userId: string;
|
||||
messageId: number;
|
||||
mailboxId: string;
|
||||
@@ -126,13 +117,13 @@ export interface EmailSentNotificationParams {
|
||||
from: { name?: string; address: string };
|
||||
}
|
||||
|
||||
export interface EmailStatusNotificationParams {
|
||||
export interface IEmailStatusNotificationParams {
|
||||
userId: string;
|
||||
messageId: number;
|
||||
mailboxId: string;
|
||||
}
|
||||
|
||||
export interface MailboxUpdateNotificationParams {
|
||||
export interface IMailboxUpdateNotificationParams {
|
||||
userId: string;
|
||||
mailboxId: string;
|
||||
mailboxName: string;
|
||||
|
||||
Reference in New Issue
Block a user