Files
gridpilot.gg/packages/notifications/domain/repositories/INotificationRepository.ts
2025-12-11 13:50:38 +01:00

60 lines
1.4 KiB
TypeScript

/**
* Repository Interface: INotificationRepository
*
* Defines the contract for persisting and retrieving Notification entities.
*/
import type { Notification } from '../entities/Notification';
import type { NotificationType } from '../types/NotificationTypes';
export interface INotificationRepository {
/**
* Find a notification by ID
*/
findById(id: string): Promise<Notification | null>;
/**
* Find all notifications for a recipient
*/
findByRecipientId(recipientId: string): Promise<Notification[]>;
/**
* Find unread notifications for a recipient
*/
findUnreadByRecipientId(recipientId: string): Promise<Notification[]>;
/**
* Find notifications by type for a recipient
*/
findByRecipientIdAndType(recipientId: string, type: NotificationType): Promise<Notification[]>;
/**
* Count unread notifications for a recipient
*/
countUnreadByRecipientId(recipientId: string): Promise<number>;
/**
* Save a new notification
*/
create(notification: Notification): Promise<void>;
/**
* Update an existing notification
*/
update(notification: Notification): Promise<void>;
/**
* Delete a notification
*/
delete(id: string): Promise<void>;
/**
* Delete all notifications for a recipient
*/
deleteAllByRecipientId(recipientId: string): Promise<void>;
/**
* Mark all notifications as read for a recipient
*/
markAllAsReadByRecipientId(recipientId: string): Promise<void>;
}