feat: add notification microservices and transactional outbox
هذا الالتزام موجود في:
1
libs/contracts/src/index.ts
Normal file
1
libs/contracts/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './notifications.contract';
|
||||
45
libs/contracts/src/notifications.contract.ts
Normal file
45
libs/contracts/src/notifications.contract.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
export const NOTIFICATION_RMQ_QUEUE = 'oudelaa.notifications';
|
||||
export const NOTIFICATION_RMQ_DLQ = 'oudelaa.notifications.dlq';
|
||||
|
||||
export const NOTIFICATION_RPC = {
|
||||
list: 'notifications.list',
|
||||
unreadCount: 'notifications.unread-count',
|
||||
markRead: 'notifications.mark-read',
|
||||
markAllRead: 'notifications.mark-all-read',
|
||||
} as const;
|
||||
|
||||
export interface MessageContext {
|
||||
correlationId: string;
|
||||
requestId: string;
|
||||
}
|
||||
|
||||
export interface NotificationListRequest {
|
||||
recipientId: string;
|
||||
query: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface NotificationUnreadCountRequest {
|
||||
recipientId: string;
|
||||
category?: string;
|
||||
}
|
||||
|
||||
export interface NotificationMarkReadRequest {
|
||||
recipientId: string;
|
||||
notificationId: string;
|
||||
}
|
||||
|
||||
export interface NotificationMarkAllReadRequest {
|
||||
recipientId: string;
|
||||
}
|
||||
|
||||
export interface NotificationRealtimeUpdate {
|
||||
recipientId: string;
|
||||
notification?: unknown;
|
||||
unreadCount: number;
|
||||
unreadCounts?: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface NotificationRpcResponse<T> {
|
||||
result: T;
|
||||
realtime?: NotificationRealtimeUpdate;
|
||||
}
|
||||
5
libs/contracts/tsconfig.lib.json
Normal file
5
libs/contracts/tsconfig.lib.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": { "declaration": true, "outDir": "../../dist/libs/contracts" },
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
المرجع في مشكلة جديدة
حظر مستخدم