feat: Implement notifications modernization

This commit is contained in:
gpt-engineer-app[bot]
2025-10-14 19:57:43 +00:00
parent 81d0569628
commit 93a77bf091
4 changed files with 599 additions and 336 deletions

View File

@@ -0,0 +1,78 @@
/**
* Notification Type Definitions
*
* Centralized types for notification system.
* Follows project patterns for type safety and validation.
*/
/**
* Channel preferences for receiving notifications
*/
export interface ChannelPreferences {
in_app: boolean;
email: boolean;
push: boolean;
sms: boolean;
}
/**
* Per-workflow notification preferences
*/
export interface WorkflowPreferences {
[workflowId: string]: boolean;
}
/**
* Notification frequency control settings
*/
export interface FrequencySettings {
digest: 'realtime' | 'hourly' | 'daily' | 'weekly';
max_per_hour: number;
}
/**
* Complete notification preferences structure
*/
export interface NotificationPreferences {
channelPreferences: ChannelPreferences;
workflowPreferences: WorkflowPreferences;
frequencySettings: FrequencySettings;
}
/**
* Notification template from database
*/
export interface NotificationTemplate {
id: string;
workflow_id: string;
novu_workflow_id: string | null;
name: string;
description: string | null;
category: string;
is_active: boolean;
created_at: string;
updated_at: string;
}
/**
* Subscriber data for Novu
*/
export interface SubscriberData {
subscriberId: string;
email?: string;
firstName?: string;
lastName?: string;
phone?: string;
avatar?: string;
data?: Record<string, any>;
}
/**
* Notification payload for triggering workflows
*/
export interface NotificationPayload {
workflowId: string;
subscriberId: string;
payload: Record<string, any>;
overrides?: Record<string, any>;
}