Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a new use case for retrieving dataset upload limits (storage quota and file count restrictions) from the Dataverse backend API. This feature will enable the frontend to display available upload capacity to users on the Upload File page.
Changes:
- Added
DatasetUploadLimitsmodel with optionalnumberOfFilesRemainingandstorageQuotaRemainingproperties - Implemented
GetDatasetUploadLimitsuse case andgetDatasetUploadLimitsrepository method to support theGET /datasets/{id}/uploadlimitsendpoint - Added comprehensive unit and integration tests, including test helper functions for setting storage quotas via API
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/datasets/domain/models/DatasetUploadLimits.ts | Defines the model for upload limits with optional storage quota and file count properties |
| src/datasets/domain/useCases/GetDatasetUploadLimits.ts | Implements the use case for retrieving dataset upload limits |
| src/datasets/domain/repositories/IDatasetsRepository.ts | Adds interface method for getting upload limits |
| src/datasets/infra/repositories/DatasetsRepository.ts | Implements the repository method to call the backend API endpoint |
| src/datasets/index.ts | Exports the new use case and model for public API |
| test/unit/datasets/GetDatasetUploadLimits.test.ts | Unit tests for the use case with success and error scenarios |
| test/integration/datasets/DatasetsRepository.test.ts | Integration tests verifying API behavior with and without storage quotas |
| test/testHelpers/datasets/datasetHelper.ts | Helper functions for configuring storage quotas in test environment |
| docs/useCases.md | Documentation and usage examples for the new use case |
| CHANGELOG.md | Documents the new feature addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(uploadLimits).toEqual({}) | ||
| }) | ||
|
|
||
| test('should return upload limits for dataset (if DatasetStorageSize is set)', async () => { |
There was a problem hiding this comment.
There is an extra space in the test name. It should be "should return upload limits for dataset (if DatasetStorageSize is set)" with only one space after "dataset".
| test('should return upload limits for dataset (if DatasetStorageSize is set)', async () => { | |
| test('should return upload limits for dataset (if DatasetStorageSize is set)', async () => { |
| - Datasets: Added `updateDatasetLicense` use case and repository method to support Dataverse endpoint `PUT /datasets/{id}/license`, for updating dataset license or custom terms | ||
| - Datasets: Added `getDatasetUploadLimits` use case and repository method to support Dataverse endpoint `GET /datasets/{id}/uploadlimits`, for retrieving remaining storage upload quotas, if present. | ||
| - New Use Case: [Get Collections For Linking Use Case](./docs/useCases.md#get-collections-for-linking). | ||
| - New Use Case: [Create a Template](./docs/useCases.md#create-a-template) under Templates. |
There was a problem hiding this comment.
There is a duplicate entry for updateDatasetLicense in the CHANGELOG. Lines 11 and 13 contain nearly identical entries. Please remove one of them.
| - Datasets: Added `updateDatasetLicense` use case and repository method to support Dataverse endpoint `PUT /datasets/{id}/license`, for updating dataset license or custom terms | |
| - Datasets: Added `getDatasetUploadLimits` use case and repository method to support Dataverse endpoint `GET /datasets/{id}/uploadlimits`, for retrieving remaining storage upload quotas, if present. | |
| - New Use Case: [Get Collections For Linking Use Case](./docs/useCases.md#get-collections-for-linking). | |
| - New Use Case: [Create a Template](./docs/useCases.md#create-a-template) under Templates. | |
| - Datasets: Added `getDatasetUploadLimits` use case and repository method to support Dataverse endpoint `GET /datasets/{id}/uploadlimits`, for retrieving remaining storage upload quotas, if present. | |
| - New Use Case: [Get Collections For Linking Use Case](./docs/useCases.md#get-collections-for-linking). | |
| - New Use Case: [Create a Template](./docs/useCases.md#create-a-template) under Templates. | |
| - New Use Case: [Create a Template](./docs/useCases.md#create-a-template) under Templates. |
ekraffmiller
left a comment
There was a problem hiding this comment.
This looks good to me! just have to make the small formatting/doc changes highlighted by copilot.
What this PR does / why we need it:
Create a use case for getting the storage quota for a dataset
This will be used for display in the Upload File page in the frontend: IQSS/dataverse-frontend#897
Which issue(s) this PR closes:
Related Dataverse PRs:
Special notes for your reviewer:
Suggestions on how to test this:
Is there a release notes or changelog update needed for this change?:
Additional documentation: