feat: add notification microservices and transactional outbox
فشلت بعض الفحوصات
Deploy To Ghaymah / quality (push) Has been cancelled
Deploy To Ghaymah / deploy (push) Has been cancelled

هذا الالتزام موجود في:
boutmoun123
2026-08-05 14:46:12 +03:00
الأصل 2fd5322ef7
التزام 8147f3b191
62 ملفات معدلة مع 2212 إضافات و126 حذوفات

عرض الملف

@@ -0,0 +1,34 @@
export const FOLLOW_REQUEST_APPROVED_EVENT = 'follow.request.approved' as const;
export interface FollowRequestApprovedEvent {
eventId: string;
eventType: typeof FOLLOW_REQUEST_APPROVED_EVENT;
occurredAt: string;
payload: {
requestId: string;
actorId: string;
recipientId: string;
};
}
export function isFollowRequestApprovedEvent(value: unknown): value is FollowRequestApprovedEvent {
if (!value || typeof value !== 'object') return false;
const event = value as Partial<FollowRequestApprovedEvent>;
const payload = event.payload as Partial<FollowRequestApprovedEvent['payload']> | undefined;
return event.eventType === FOLLOW_REQUEST_APPROVED_EVENT
&& isNonEmptyString(event.eventId)
&& isIsoDateString(event.occurredAt)
&& isNonEmptyString(payload?.requestId)
&& isNonEmptyString(payload.actorId)
&& isNonEmptyString(payload.recipientId);
}
const isNonEmptyString = (value: unknown): value is string =>
typeof value === 'string' && value.trim().length > 0;
const isIsoDateString = (value: unknown): value is string => {
if (typeof value !== 'string') return false;
const timestamp = Date.parse(value);
if (Number.isNaN(timestamp)) return false;
return new Date(timestamp).toISOString() === value;
};

1
libs/events/src/index.ts Normal file
عرض الملف

@@ -0,0 +1 @@
export * from './follow-request-approved.event';

عرض الملف

@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": { "declaration": true, "outDir": "../../dist/libs/events" },
"include": ["src/**/*.ts"]
}