add use cases for editing template to TemplatesRepository.ts#430
add use cases for editing template to TemplatesRepository.ts#430ekraffmiller wants to merge 10 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds three new use cases for editing dataset templates: updating template metadata, license terms, and terms of access. The changes follow the existing architectural patterns in the codebase with proper separation between domain use cases, repository interfaces, and infrastructure implementations. The PR includes comprehensive test coverage at both unit and functional levels.
Changes:
- Added three new use case classes (UpdateTemplateMetadata, UpdateTemplateLicenseTerms, UpdateTemplateTermsOfAccess) with corresponding DTOs
- Extended ITemplatesRepository interface and TemplatesRepository implementation with three new methods
- Added a transformer function for terms of access payload conversion
- Updated GitHub Actions workflows to use newer versions (Node 22, actions v4)
- Modified test environment to use a custom Dataverse image for testing new API endpoints
- Enhanced test resilience for concurrent execution in GetDatasetAvailableDatasetTypes test
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/templates/domain/useCases/UpdateTemplateMetadata.ts | New use case for updating template metadata with optional replace parameter |
| src/templates/domain/useCases/UpdateTemplateLicenseTerms.ts | New use case for updating template license terms |
| src/templates/domain/useCases/UpdateTemplateTermsOfAccess.ts | New use case for updating template terms of access |
| src/templates/domain/dtos/UpdateTemplateMetadataDTO.ts | DTO for template metadata updates |
| src/templates/domain/dtos/UpdateTemplateLicenseTermsDTO.ts | DTO for license terms updates |
| src/templates/domain/repositories/ITemplatesRepository.ts | Extended interface with three new update methods |
| src/templates/infra/repositories/TemplatesRepository.ts | Implementation of update methods using a private helper |
| src/templates/infra/repositories/transformers/templateTermsOfAccessTransformers.ts | Transformer for converting TermsOfAccess to API payload format |
| src/templates/index.ts | Exported new use cases and DTOs |
| test/unit/templates/UpdateTemplateMetadata.test.ts | Unit tests for metadata update use case |
| test/unit/templates/UpdateTemplateLicenseTerms.test.ts | Unit tests for license terms update use case |
| test/unit/templates/UpdateTemplateTermsOfAccess.test.ts | Unit tests for terms of access update use case |
| test/unit/templates/TemplatesRepositoryTemplateUpdates.test.ts | Unit tests for repository update methods |
| test/functional/templates/UpdateTemplateMetadata.test.ts | Functional test for metadata updates |
| test/functional/templates/UpdateTemplateLicenseTerms.test.ts | Functional test for license terms updates |
| test/functional/templates/UpdateTemplateTermsOfAccess.test.ts | Functional test for terms of access updates |
| test/functional/datasets/GetDatasetAvailableDatasetTypes.test.ts | Enhanced test to handle concurrent execution |
| test/environment/.env | Updated to use custom Dataverse image for testing new APIs |
| .github/workflows/lint.yml | Updated to Node 22 and actions v4 |
| .github/workflows/deploy_pr.yml | Updated to Node 22 and actions v4 |
| .github/workflows/deploy_alpha.yml | Updated to Node 22 and actions v4 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| DATAVERSE_IMAGE_REGISTRY=docker.io | ||
| DATAVERSE_IMAGE_TAG=unstable | ||
| DATAVERSE_IMAGE_REGISTRY=ghcr.io | ||
| DATAVERSE_IMAGE_TAG=11912-edit-template-api |
There was a problem hiding this comment.
The DATAVERSE_IMAGE_TAG uses "11912-edit-template-api", but the PR description states this PR depends on "IQSS/dataverse/12159". There appears to be a discrepancy in the PR numbers. Please verify that this is the correct image tag that corresponds to the dependent backend PR, or update it to match PR 12159 if that's the correct dependency.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/dataverse-client-javascript into 427-edit-template-use-cases
What this PR does / why we need it:
Which issue(s) this PR closes:
Related Dataverse PRs:
Special notes for your reviewer:
I updated the github actions to use a new version of node because the actions were intermittently failing during the build.
Suggestions on how to test this:
review/run test code
Is there a release notes or changelog update needed for this change?:
yes
Additional documentation: