Skip to content

GET and DELETE a template Use Case and Restructure#906

Merged
jp-tosca merged 10 commits intodevelopfrom
Get_DeleteATemplate
Feb 5, 2026
Merged

GET and DELETE a template Use Case and Restructure#906
jp-tosca merged 10 commits intodevelopfrom
Get_DeleteATemplate

Conversation

@ChengShi-1
Copy link
Copy Markdown
Contributor

@ChengShi-1 ChengShi-1 commented Jan 8, 2026

What this PR does / why we need it:

  • Get A Template use case
  • Delete A Template use case
  • Create A Template use case
  • Move Get Dataset Templates to a /templates folder with all use cases above

Which issue(s) this PR closes:

Special notes for your reviewer:

  • There is no UI changes, package.json needs to be updated once the js-dataverse gets new alpha version with template apis

Suggestions on how to test this:

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

no ui change

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

Additional documentation:

@github-actions github-actions Bot added FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) GREI Re-arch GREI re-architecture-related SPA.Q4.2025.1 labels Jan 8, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 8, 2026

Coverage Status

coverage: 97.764% (+0.4%) from 97.362%
when pulling 9d5ba72 on Get_DeleteATemplate
into 1cb2d40 on develop.

@ChengShi-1 ChengShi-1 added Size: 10 A percentage of a sprint. 7 hours. Original size: 10 labels Jan 8, 2026
@ChengShi-1 ChengShi-1 moved this to In Progress 💻 in IQSS Dataverse Project Jan 8, 2026
@ChengShi-1 ChengShi-1 moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Jan 9, 2026
@ChengShi-1 ChengShi-1 marked this pull request as ready for review January 9, 2026 18:44
@ekraffmiller ekraffmiller self-assigned this Jan 9, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jan 9, 2026
@ekraffmiller ekraffmiller removed their assignment Jan 9, 2026
@ekraffmiller ekraffmiller moved this from In Review 🔎 to Ready for Review ⏩ in IQSS Dataverse Project Jan 9, 2026
@ChengShi-1 ChengShi-1 moved this from Ready for Review ⏩ to In Progress 💻 in IQSS Dataverse Project Jan 13, 2026
@ChengShi-1 ChengShi-1 self-assigned this Jan 13, 2026
@ChengShi-1 ChengShi-1 moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Jan 13, 2026
@ChengShi-1 ChengShi-1 removed their assignment Jan 13, 2026
@ekraffmiller ekraffmiller self-assigned this Jan 14, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jan 14, 2026
@ChengShi-1 ChengShi-1 requested a review from Copilot January 14, 2026 19:10
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 pull request restructures template-related functionality by creating a dedicated /templates folder with new use cases for template management (getTemplate, deleteTemplate, createTemplate) and moving the existing getTemplatesByCollectionId functionality. The changes update the codebase to use a new TemplateRepository interface and rename DatasetTemplate to Template for better alignment with API conventions.

Changes:

  • Introduced new template use cases: getTemplate, deleteTemplate, and createTemplate in a dedicated templates folder
  • Renamed DatasetTemplate interface to Template and moved template-related logic from DatasetRepository to TemplateRepository
  • Updated package dependency to @iqss/dataverse-client-javascript version 2.1.0-pr406.31ac368 to support new template APIs

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/templates/domain/useCases/*.ts New use case functions for template operations (get, delete, create)
src/templates/domain/repositories/TemplateRepository.ts New repository interface for template operations
src/templates/infrastructure/repositories/TemplateJSDataverseRepository.ts Implementation of TemplateRepository using js-dataverse client
src/templates/domain/models/Template.ts Duplicate Template interface definition (also in DatasetTemplate.ts)
src/dataset/domain/models/DatasetTemplate.ts Renamed DatasetTemplate to Template interface
src/dataset/domain/useCases/getTemplatesByCollectionId.ts Moved use case that should be in templates folder
src/dataset/domain/repositories/DatasetRepository.ts Removed getTemplates method
src/sections/create-dataset/*.tsx Updated to use TemplateRepository and renamed interfaces
tests/**/*.spec.tsx Updated test files to use TemplateRepository and new naming
package.json Updated js-dataverse dependency to PR build version
CHANGELOG.md Added entry for template refactoring

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/templates/domain/models/Template.ts
Comment thread package.json Outdated
"@dnd-kit/utilities": "3.2.2",
"@faker-js/faker": "7.6.0",
"@iqss/dataverse-client-javascript": "2.0.0-alpha.79",
"@iqss/dataverse-client-javascript": "2.1.0-pr406.31ac368",
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The package version "2.1.0-pr406.31ac368" appears to be a pre-release PR build rather than a stable version. PR builds are typically used for testing and should not be committed to the main branch. According to the PR description, package.json was intended to be updated once the js-dataverse gets a new alpha version with template APIs. Consider updating this to a stable or alpha release version (e.g., "2.1.0-alpha.80" or similar) before merging, or ensure the corresponding PR in js-dataverse is merged first.

Suggested change
"@iqss/dataverse-client-javascript": "2.1.0-pr406.31ac368",
"@iqss/dataverse-client-javascript": "2.1.0-alpha.80",

Copilot uses AI. Check for mistakes.
Comment thread src/templates/domain/useCases/getTemplatesByCollectionId.ts
Comment thread CHANGELOG.md Outdated
@ChengShi-1 ChengShi-1 moved this from In Review 🔎 to Ready for Review ⏩ in IQSS Dataverse Project Jan 15, 2026
@ChengShi-1 ChengShi-1 requested a review from Copilot January 15, 2026 15:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:12

  • The interface name uses lowercase "useGetTemplatesByCollectionIdProps" but TypeScript convention typically uses PascalCase for interface names. Consider renaming to "UseGetTemplatesByCollectionIdProps" for consistency with TypeScript naming conventions.
    src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:62
  • The hook still uses "dataset" prefixes in variable and function names (datasetTemplates, isLoadingDatasetTemplates, errorGetDatasetTemplates, fetchDatasetTemplates) despite the refactoring to a generic Template model. Consider renaming these to use "template" prefixes instead (templates, isLoadingTemplates, errorGetTemplates, fetchTemplates) for better consistency with the new architecture where templates are decoupled from datasets.
    src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:18
  • The hook is located in the dataset domain folder but now deals with templates from a separate domain. Consider moving this hook to a templates/domain/hooks folder to better align with domain-driven design principles and the separation of concerns established by the new templates domain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/templates/domain/useCases/getTemplate.ts
Comment thread src/templates/domain/useCases/deleteTemplate.ts
Comment thread src/templates/domain/useCases/createTemplate.ts
@ChengShi-1
Copy link
Copy Markdown
Contributor Author

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)
src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:12

  • The interface name uses lowercase "useGetTemplatesByCollectionIdProps" but TypeScript convention typically uses PascalCase for interface names. Consider renaming to "UseGetTemplatesByCollectionIdProps" for consistency with TypeScript naming conventions.
    src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:62
  • The hook still uses "dataset" prefixes in variable and function names (datasetTemplates, isLoadingDatasetTemplates, errorGetDatasetTemplates, fetchDatasetTemplates) despite the refactoring to a generic Template model. Consider renaming these to use "template" prefixes instead (templates, isLoadingTemplates, errorGetTemplates, fetchTemplates) for better consistency with the new architecture where templates are decoupled from datasets.
    src/dataset/domain/hooks/useGetTemplatesByCollectionId.ts:18
  • The hook is located in the dataset domain folder but now deals with templates from a separate domain. Consider moving this hook to a templates/domain/hooks folder to better align with domain-driven design principles and the separation of concerns established by the new templates domain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot suggested adding tests for the use cases, which I chose not to do at that time, since I would add tests once the use cases were actually in use.

@cmbz cmbz added the FY26 Sprint 15 FY26 Sprint 15 (2026-01-14 - 2026-01-28) label Jan 15, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jan 16, 2026
Copy link
Copy Markdown
Contributor

@ekraffmiller ekraffmiller 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! Just need to change the js-dataverse version, now that dependent PR has been merged

Copy link
Copy Markdown
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

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

approved!

@github-project-automation github-project-automation Bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Jan 16, 2026
@cmbz cmbz added the FY26 Sprint 16 FY26 Sprint 16 (2026-01-28 - 2026-02-11) label Jan 29, 2026
@jp-tosca jp-tosca self-assigned this Feb 4, 2026
@jp-tosca jp-tosca moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project Feb 4, 2026
@jp-tosca jp-tosca merged commit 24bdb22 into develop Feb 5, 2026
12 of 16 checks passed
@github-project-automation github-project-automation Bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project Feb 5, 2026
@jp-tosca jp-tosca removed their assignment Feb 5, 2026
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) FY26 Sprint 15 FY26 Sprint 15 (2026-01-14 - 2026-01-28) FY26 Sprint 16 FY26 Sprint 16 (2026-01-28 - 2026-02-11) GREI Re-arch GREI re-architecture-related Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA.Q4.2025.1

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

GET and DELETE a template Use Case and Restructure

7 participants