forked from IQSS/dataverse-client-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetAllNotificationsByUser.ts
More file actions
19 lines (17 loc) · 877 Bytes
/
Copy pathGetAllNotificationsByUser.ts
File metadata and controls
19 lines (17 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { UseCase } from '../../../core/domain/useCases/UseCase'
import { Notification } from '../models/Notification'
import { INotificationsRepository } from '../repositories/INotificationsRepository'
export class GetAllNotificationsByUser implements UseCase<Notification[]> {
constructor(private readonly notificationsRepository: INotificationsRepository) {}
/**
* Use case for retrieving all notifications for the current user.
*
* @param inAppNotificationFormat - Optional parameter to retrieve fields needed for in-app notifications
* @returns {Promise<Notification[]>} - A promise that resolves to an array of Notification instances.
*/
async execute(inAppNotificationFormat?: boolean): Promise<Notification[]> {
return (await this.notificationsRepository.getAllNotificationsByUser(
inAppNotificationFormat
)) as Notification[]
}
}