-
Notifications
You must be signed in to change notification settings - Fork 10
Use Cases of Get and Delete a template #406
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
base: develop
Are you sure you want to change the base?
Use Cases of Get and Delete a template #406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR restructures template-related functionality into a dedicated /templates module and adds new use cases for getting and deleting templates. The changes move template operations from the datasets and collections modules to a more appropriate domain-specific location.
Key Changes:
- Created new Templates module with dedicated use cases: CreateTemplate, GetTemplate, GetDatasetTemplates, and DeleteTemplate
- Migrated template functionality from datasets and collections modules to the new templates module
- Added comprehensive unit, integration, and functional tests for the new template operations
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/templates/domain/useCases/GetTemplate.ts | New use case for retrieving a single template by ID |
| src/templates/domain/useCases/DeleteTemplate.ts | New use case for deleting a template by ID |
| src/templates/domain/useCases/CreateTemplate.ts | Migrated and updated CreateTemplate use case from collections module |
| src/templates/domain/useCases/GetDatasetTemplates.ts | Migrated use case for getting templates by collection |
| src/templates/domain/repositories/ITemplatesRepository.ts | New repository interface defining template operations |
| src/templates/domain/models/Template.ts | Updated template model definitions (renamed from DatasetTemplate) |
| src/templates/infra/repositories/TemplatesRepository.ts | New repository implementation for template operations |
| src/templates/infra/repositories/transformers/templateTransformers.ts | Transformer logic migrated from datasets module |
| src/templates/infra/repositories/transformers/TemplatePayload.ts | Updated payload interface for templates |
| src/templates/index.ts | Module exports for templates domain |
| src/index.ts | Added templates module to main exports |
| test/unit/templates/*.test.ts | New unit tests for template use cases |
| test/integration/templates/TemplateRepository.test.ts | Comprehensive integration tests for template repository |
| test/functional/templates/createDatasetTemplate.test.ts | Updated functional test with new import paths |
| src/datasets/domain/useCases/GetDatasetTemplates.ts | Removed - migrated to templates module |
| src/datasets/infra/repositories/transformers/datasetTemplateTransformers.ts | Removed - migrated to templates module |
| src/collections/domain/useCases/CreateDatasetTemplate.ts | Removed - migrated to templates module |
| src/collections/infra/repositories/CollectionsRepository.ts | Removed createDatasetTemplate method |
| docs/useCases.md | Updated documentation with new Templates section and reorganized template use cases |
| CHANGELOG.md | Updated with new template use cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ekraffmiller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I just have some suggestions about the naming conventions
| template: CreateDatasetTemplateDTO | ||
| ): Promise<void> | ||
| getTemplate(templateId: number): Promise<Template> | ||
| getDatasetTemplates(collectionIdOrAlias: number | string): Promise<Template[]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming of the two get functions are a little confusing. At first glance, it seems like getDatasetTemplates() may be returning all Templates for a Dataset.
Instead of getDatasetTemplates(), can we change it to getTemplatesByCollectionId()? That way it is more clear what is being returned.
| * Creates a Dataset Template in the specified collection. | ||
| * Creates a template in the specified collection. | ||
| * | ||
| * @param {CreateDatasetTemplateDTO} template - Template definition payload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * @param {CreateDatasetTemplateDTO} template - Template definition payload. | |
| * @param {CreateTemplateDTO} template - Template definition payload. |
What this PR does / why we need it:
Which issue(s) this PR closes:
Related Dataverse PRs:
Special notes for your reviewer:
Templateinstead ofDataset Template, besidesgetDatasetTemplatesuse caseSuggestions on how to test this:
Is there a release notes or changelog update needed for this change?:
YES
Additional documentation: