-
Notifications
You must be signed in to change notification settings - Fork 10
Update GetAllNotificationsByUser use case #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
967a016
update GetAllNotificationsByUser use case
ekraffmiller 40189c8
add integration tests
ekraffmiller 2ebd8af
add changelog entry
ekraffmiller 7e86b76
feat: add totalCount to results
ekraffmiller 8d571f3
fix tests and remove logs
ekraffmiller 43e283a
resolve merge conflicts
ekraffmiller a0c2e75
Merge branch 'develop' into 386-update-notifications-use-case
ekraffmiller df6436a
resolve merge conflicts
ekraffmiller 341f655
fix NotificationsRepository.test.ts: use persistentId to test the cor…
ekraffmiller 10460ef
update .env: change DATAVERSE_IMAGE_TAG to unstable
jp-tosca 8b77e8f
update .env: change DATAVERSE_IMAGE_TAG to 11852-notifs-api-paginatio…
jp-tosca 29e036a
update .env: change DATAVERSE_IMAGE_REGISTRY to docker.io and reset D…
jp-tosca 2a1a04c
fix CollectionsRepository.test.ts: use persistentId to test the corre…
ekraffmiller 2c0d6c5
Merge branch '386-update-notifications-use-case' of https://github.co…
ekraffmiller 83d52ae
fix CollectionsRepository.test.ts: remove test of datasetCitation fro…
ekraffmiller 160d58b
fix CollectionsRepository.test.ts: remove additional test of datasetC…
ekraffmiller 6eba2d8
fix CollectionsRepository.test.ts: comment out tests that are affecte…
ekraffmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { Notification } from './Notification' | ||
|
|
||
| export interface NotificationSubset { | ||
| notifications: Notification[] | ||
| totalNotificationCount: number | ||
| } |
9 changes: 7 additions & 2 deletions
9
src/notifications/domain/repositories/INotificationsRepository.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 17 additions & 6 deletions
23
src/notifications/domain/useCases/GetAllNotificationsByUser.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,30 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { Notification } from '../models/Notification' | ||
| import { INotificationsRepository } from '../repositories/INotificationsRepository' | ||
| import { NotificationSubset } from '../models/NotificationSubset' | ||
|
|
||
| export class GetAllNotificationsByUser implements UseCase<Notification[]> { | ||
| export class GetAllNotificationsByUser implements UseCase<NotificationSubset> { | ||
| 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. | ||
| * @param onlyUnread - Optional parameter to filter only unread notifications | ||
| * @param limit - Optional parameter to limit the number of notifications returned | ||
| * @param offset - Optional parameter to skip a number of notifications (for pagination) | ||
| * @returns {Promise<NotificationSubset>} - A promise that resolves to an array of Notification instances. | ||
| */ | ||
| async execute(inAppNotificationFormat?: boolean): Promise<Notification[]> { | ||
| async execute( | ||
| inAppNotificationFormat?: boolean, | ||
| onlyUnread?: boolean, | ||
| limit?: number, | ||
| offset?: number | ||
| ): Promise<NotificationSubset> { | ||
| return (await this.notificationsRepository.getAllNotificationsByUser( | ||
| inAppNotificationFormat | ||
| )) as Notification[] | ||
| inAppNotificationFormat, | ||
| onlyUnread, | ||
| limit, | ||
| offset | ||
| )) as NotificationSubset | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.