-
Notifications
You must be signed in to change notification settings - Fork 10
Implement GetMyDataCollectionItems use case #294
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
29 commits
Select commit
Hold shift + click to select a range
61c784f
feat: add GetMyDataCollectionItems use case
ekraffmiller 4a80a4c
Merge branch 'develop' into 283-implement-my-data-use-case
ekraffmiller 4b98fd4
feat: add tests
ekraffmiller 722df10
fix: imports
ekraffmiller 84259da
fix: unit test, remove logs
ekraffmiller 4639b86
fix: functional test
ekraffmiller 9e79bb4
change test data
ekraffmiller c57cc01
fix search query param
ekraffmiller edf0409
search for collection alias
ekraffmiller 24ae72a
add more tests of response data
ekraffmiller 02c8f6b
update documentation
ekraffmiller 4a1f13e
fix documentation return value
ekraffmiller 89dc408
fix parameter name to match API endpoint,
ekraffmiller 34b2588
in countPerObjectType, change key to from 'dataverses' to 'collections'
ekraffmiller 4519702
update countPerObjectType in tests
ekraffmiller 4c62154
update countPerObjectType in unit tests
ekraffmiller 35a85f3
revert wait time in PublishDataset.test.ts
ekraffmiller 0a0dd88
use CollectionItemSubset.ts as return type
ekraffmiller a153656
add GetMyDataCollectionItems integration test
ekraffmiller 7877358
fix import
ekraffmiller 4a45184
fix integration tests
ekraffmiller 5e53ed5
remove logs
ekraffmiller 2042bd3
create new user for mydata integration test
ekraffmiller d7a1f4a
fix integration test
ekraffmiller d17df32
remove logging, make create superuser conditional
ekraffmiller af1dd72
remove commented code
ekraffmiller 47d8743
fix use case description
ekraffmiller 728df66
fix return type in documentation
ekraffmiller 51208b7
remove console.log()
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
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
45 changes: 45 additions & 0 deletions
45
src/collections/domain/useCases/GetMyDataCollectionItems.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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { CollectionItemSubset } from '../models/CollectionItemSubset' | ||
| import { ICollectionsRepository } from '../repositories/ICollectionsRepository' | ||
| import { CollectionItemType } from '../../../../src/collections/domain/models/CollectionItemType' | ||
| import { PublicationStatus } from '../../../../src/core/domain/models/PublicationStatus' | ||
|
|
||
| export class GetMyDataCollectionItems implements UseCase<CollectionItemSubset> { | ||
| private collectionsRepository: ICollectionsRepository | ||
|
|
||
| constructor(collectionsRepository: ICollectionsRepository) { | ||
| this.collectionsRepository = collectionsRepository | ||
| } | ||
|
|
||
| /** | ||
| * Returns an instance of MyDataCollectionItemSubset that contains the items for which the user has the specified role or roles | ||
| * | ||
| * @param {number[]} [roleIds] - the ids of the roles to filter the items by. | ||
| * @param {CollectionItemType[]} [collectionItemTypes] - the types of items to filter by. | ||
| * @param {PublicationStatus[]} [publicationStatuses] - the publication statuses to filter by. | ||
| * @param {number} [limit] - Limit number of items to return for pagination (optional). | ||
| * @param {number} [selectedPage] - Offset (starting point) for pagination (optional). | ||
| * @param {string} [searchText] - filter by searching for this text in the results (optional). | ||
| * @param {string} [otherUserName] - filter by searching for this text in the results (optional). | ||
| * * @returns {Promise<CollectionItemSubset>} | ||
| */ | ||
| async execute( | ||
| roleIds: number[], | ||
| collectionItemTypes: CollectionItemType[], | ||
| publicationStatuses: PublicationStatus[], | ||
| limit?: number, | ||
| selectedPage?: number, | ||
| searchText?: string, | ||
| otherUserName?: string | ||
| ): Promise<CollectionItemSubset> { | ||
| return this.collectionsRepository.getMyDataCollectionItems( | ||
| roleIds, | ||
| collectionItemTypes, | ||
| publicationStatuses, | ||
| limit, | ||
| selectedPage, | ||
| searchText, | ||
| otherUserName | ||
| ) | ||
| } | ||
| } |
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
14 changes: 14 additions & 0 deletions
14
src/collections/infra/repositories/transformers/MyDataCollectionPreviewPayload.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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export interface MyDataCollectionPreviewPayload { | ||
| name: string | ||
| parentDataverseName: string | ||
| identifier: string | ||
| parentDataverseIdentifier: string | ||
| url: string | ||
| image_url: string | ||
| description: string | ||
| type?: string | ||
| publicationStatuses: string[] | ||
| affiliation: string | ||
| published_at: string | ||
| user_roles: string[] | ||
| } |
5 changes: 5 additions & 0 deletions
5
src/collections/infra/repositories/transformers/MyDataCountPerObjectTypePayload.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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export interface MyDataCountPerObjectTypePayload { | ||
| dataverses_count: number | ||
| datasets_count: number | ||
| files_count: number | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/collections/infra/repositories/transformers/MyDataPublicationStatusCountsPayload.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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export interface MyDataPublicationStatusCountsPayload { | ||
| deaccessioned_count: number | ||
| draft_count: number | ||
| in_review_count: number | ||
| published_count: number | ||
| unpublished_count: number | ||
| } |
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.