Skip to content
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

Add use case to retrieve file counts by type, access and category #88

Merged
merged 7 commits into from
Sep 11, 2023

Conversation

GPortas
Copy link
Contributor

@GPortas GPortas commented Sep 3, 2023

What this PR does / why we need it:

Adds use case for getting file counts, as requested in #83.

In addition, it includes a small refactoring for the API endpoint building in the API repositories.

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

  • Visual inspection of the code
  • Check unit and integration tests execution in GitHub actions

Is there a release notes update needed for this change?:

Add GetDatasetFileCounts use case

Additional documentation:

None

@GPortas GPortas marked this pull request as ready for review September 3, 2023 17:47
@MellyGray MellyGray self-assigned this Sep 5, 2023
MellyGray
MellyGray previously approved these changes Sep 5, 2023
Copy link
Contributor

@MellyGray MellyGray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I appreciate the included refactor 👏 I'm going to start integrating this into the frontend right away

I added a comment about a naming but it's a matter of preference so I'm not blocking this PR, if you agree with the comment and want to do the change just go ahead and ask for a new approval afterwards

@@ -26,6 +26,18 @@ export abstract class ApiRepository {
});
}

protected buildApiEndpoint(resourceName: string, operation: string, resourceId: number | string = undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the refactor using this method 👍

public async getDatasetSummaryFieldNames(): Promise<string[]> {
return this.doGet('/datasets/summaryFieldNames')
return this.doGet(this.buildApiEndpoint(this.resourceName, 'summaryFieldNames'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like it better in FileRepository where the dataset resource name has this naming this.datasetsResourceName

return this.doGet(this.buildApiEndpoint(this.datasetsResourceName, 'summaryFieldNames'))

I think it helps visually seeing which resource is calling, specially because it seems like the resource called is not always the one in the repository name

@MellyGray MellyGray removed their assignment Sep 5, 2023
@MellyGray
Copy link
Contributor

@GPortas I think this PR wasn't published to the npm registry https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript

can you publish it?

Base automatically changed from 80-files-filters to develop September 11, 2023 17:53
@kcondon kcondon dismissed MellyGray’s stale review September 11, 2023 17:53

The base branch was changed.

@kcondon kcondon self-assigned this Sep 11, 2023
@kcondon kcondon merged commit 52b7b10 into develop Sep 11, 2023
2 checks passed
@kcondon kcondon deleted the 83-file-counts-use-case branch September 11, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add use case to retrieve file counts by type, access and category
3 participants