ruch
Version:
Revolutionary React TypeScript CLI with hexagonal architecture & AI-powered development assistance. Create maintainable, scalable applications with domain-driven design and integrated AI tooling.
152 lines (138 loc) • 2.85 kB
text/typescript
/**
* Notification domain entities
*/
export interface Notification {
id: string;
userId: string;
type: NotificationType;
channel: NotificationChannel;
title: string;
message: string;
data?: Record<string, any>;
status: NotificationStatus;
priority: NotificationPriority;
scheduledAt?: string;
sentAt?: string;
readAt?: string;
createdAt: string;
updatedAt: string;
}
export type NotificationType =
| 'order_confirmation'
| 'order_shipped'
| 'order_delivered'
| 'payment_success'
| 'payment_failed'
| 'account_created'
| 'password_reset'
| 'product_back_in_stock'
| 'price_drop'
| 'newsletter'
| 'promotional'
| 'system_maintenance'
| 'security_alert';
export type NotificationChannel =
| 'email'
| 'sms'
| 'push'
| 'in_app'
| 'webhook';
export type NotificationStatus =
| 'pending'
| 'sent'
| 'delivered'
| 'failed'
| 'cancelled';
export type NotificationPriority =
| 'low'
| 'normal'
| 'high'
| 'urgent';
export interface NotificationTemplate {
id: string;
type: NotificationType;
channel: NotificationChannel;
subject: string;
bodyTemplate: string;
variables: string[];
isActive: boolean;
createdAt: string;
updatedAt: string;
}
export interface CreateNotificationData {
userId: string;
type: NotificationType;
channel: NotificationChannel;
title: string;
message: string;
data?: Record<string, any>;
priority?: NotificationPriority;
scheduledAt?: string;
}
export interface BulkNotificationData {
userIds: string[];
type: NotificationType;
channel: NotificationChannel;
title: string;
message: string;
data?: Record<string, any>;
priority?: NotificationPriority;
scheduledAt?: string;
}
export interface NotificationPreferences {
userId: string;
email: {
orderUpdates: boolean;
promotions: boolean;
newsletter: boolean;
securityAlerts: boolean;
};
sms: {
orderUpdates: boolean;
urgentAlerts: boolean;
};
push: {
orderUpdates: boolean;
promotions: boolean;
recommendations: boolean;
};
inApp: {
all: boolean;
};
updatedAt: string;
}
export interface NotificationStats {
sent: number;
delivered: number;
failed: number;
opened: number;
clicked: number;
unsubscribed: number;
deliveryRate: number;
openRate: number;
clickRate: number;
}
export interface EmailNotificationData {
to: string;
subject: string;
htmlBody: string;
textBody?: string;
attachments?: EmailAttachment[];
}
export interface EmailAttachment {
filename: string;
content: string;
contentType: string;
}
export interface SMSNotificationData {
to: string;
message: string;
}
export interface PushNotificationData {
userId: string;
title: string;
body: string;
icon?: string;
badge?: number;
data?: Record<string, any>;
}