Some checks failed
Dev CI / Unit Tests (${{ matrix.app }}) (backend) (push) Blocked by required conditions
Dev CI / Unit Tests (${{ matrix.app }}) (frontend) (push) Blocked by required conditions
Dev CI / Notify Failure (push) Blocked by required conditions
Dev CI / Quality (${{ matrix.app }}) (backend) (push) Has been cancelled
Dev CI / Quality (${{ matrix.app }}) (frontend) (push) Has been cancelled
Aligns dev with the complete application codebase (cicd branch). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
81 lines
1.8 KiB
TypeScript
81 lines
1.8 KiB
TypeScript
/**
|
|
* Notification Repository Port
|
|
*
|
|
* Defines the interface for Notification persistence operations.
|
|
* This is a secondary port (output port) in hexagonal architecture.
|
|
*/
|
|
|
|
import { Notification } from '../../entities/notification.entity';
|
|
|
|
export const NOTIFICATION_REPOSITORY = 'NotificationRepository';
|
|
|
|
export interface NotificationFilters {
|
|
userId?: string;
|
|
organizationId?: string;
|
|
type?: string[];
|
|
read?: boolean;
|
|
priority?: string[];
|
|
startDate?: Date;
|
|
endDate?: Date;
|
|
offset?: number;
|
|
limit?: number;
|
|
}
|
|
|
|
export interface NotificationRepository {
|
|
/**
|
|
* Save a notification entity
|
|
*/
|
|
save(notification: Notification): Promise<void>;
|
|
|
|
/**
|
|
* Find notification by ID
|
|
*/
|
|
findById(id: string): Promise<Notification | null>;
|
|
|
|
/**
|
|
* Find notifications by filters
|
|
*/
|
|
findByFilters(filters: NotificationFilters): Promise<Notification[]>;
|
|
|
|
/**
|
|
* Count notifications matching filters
|
|
*/
|
|
count(filters: NotificationFilters): Promise<number>;
|
|
|
|
/**
|
|
* Find unread notifications for a user
|
|
*/
|
|
findUnreadByUser(userId: string, limit?: number): Promise<Notification[]>;
|
|
|
|
/**
|
|
* Count unread notifications for a user
|
|
*/
|
|
countUnreadByUser(userId: string): Promise<number>;
|
|
|
|
/**
|
|
* Find recent notifications for a user
|
|
*/
|
|
findRecentByUser(userId: string, limit?: number): Promise<Notification[]>;
|
|
|
|
/**
|
|
* Mark a notification as read
|
|
*/
|
|
markAsRead(id: string): Promise<void>;
|
|
|
|
/**
|
|
* Mark all notifications as read for a user
|
|
*/
|
|
markAllAsReadForUser(userId: string): Promise<void>;
|
|
|
|
/**
|
|
* Delete a notification
|
|
*/
|
|
delete(id: string): Promise<void>;
|
|
|
|
/**
|
|
* Delete old read notifications
|
|
* Returns the number of deleted records
|
|
*/
|
|
deleteOldReadNotifications(olderThanDays: number): Promise<number>;
|
|
}
|