wip
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Application Use Case: GetUnreadNotificationsUseCase
|
||||
*
|
||||
* Retrieves unread notifications for a recipient.
|
||||
*/
|
||||
|
||||
import type { Notification } from '../../domain/entities/Notification';
|
||||
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
|
||||
|
||||
export interface UnreadNotificationsResult {
|
||||
notifications: Notification[];
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
export class GetUnreadNotificationsUseCase {
|
||||
constructor(
|
||||
private readonly notificationRepository: INotificationRepository,
|
||||
) {}
|
||||
|
||||
async execute(recipientId: string): Promise<UnreadNotificationsResult> {
|
||||
const notifications = await this.notificationRepository.findUnreadByRecipientId(recipientId);
|
||||
|
||||
return {
|
||||
notifications,
|
||||
totalCount: notifications.length,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional notification query/use case types (e.g., listing or counting notifications)
|
||||
* can be added here in the future as needed.
|
||||
*/
|
||||
Reference in New Issue
Block a user