-
Notifications
You must be signed in to change notification settings - Fork 10
add use cases for editing template to TemplatesRepository.ts #430
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
Open
ekraffmiller
wants to merge
10
commits into
develop
Choose a base branch
from
427-edit-template-use-cases
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7f37fe1
add use cases for editing template to TemplatesRepository.ts
ekraffmiller a6df2e2
modify GetAvailableDatasetTypes.test.ts to account for concurrently r…
ekraffmiller 5cb432a
fix test assertion
ekraffmiller 4b6149b
update node version in github actions
ekraffmiller b98a2da
Update src/templates/domain/useCases/UpdateTemplateLicenseTerms.ts
ekraffmiller 70d0228
Update src/templates/domain/useCases/UpdateTemplateTermsOfAccess.ts
ekraffmiller 2c483e5
Remove unneeded tests
ekraffmiller 503f81b
Merge branch '427-edit-template-use-cases' of https://github.com/IQSS…
ekraffmiller faade42
add documentation
ekraffmiller 7a73b1c
update CHANGELOG.md and useCases.md
ekraffmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { CustomTerms } from '../../../datasets/domain/models/Dataset' | ||
|
|
||
| export interface UpdateTemplateLicenseTermsDTO { | ||
| name?: string | ||
| customTerms?: CustomTerms | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { TemplateFieldDTO, TemplateInstructionDTO } from './CreateTemplateDTO' | ||
|
|
||
| export interface UpdateTemplateMetadataDTO { | ||
| name?: string | ||
| fields?: TemplateFieldDTO[] | ||
| instructions?: TemplateInstructionDTO[] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/templates/domain/useCases/UpdateTemplateLicenseTerms.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { UpdateTemplateLicenseTermsDTO } from '../dtos/UpdateTemplateLicenseTermsDTO' | ||
| import { ITemplatesRepository } from '../repositories/ITemplatesRepository' | ||
|
|
||
| export class UpdateTemplateLicenseTerms implements UseCase<void> { | ||
| private templatesRepository: ITemplatesRepository | ||
|
|
||
| constructor(templatesRepository: ITemplatesRepository) { | ||
| this.templatesRepository = templatesRepository | ||
| } | ||
|
|
||
| /** | ||
| * Updates the license terms for a template with the given identifier. | ||
| * | ||
| * @param {number} templateId - The unique identifier of the template to update. | ||
| * @param {UpdateTemplateLicenseTermsDTO} payload - The license terms data to apply to the template. | ||
| * @returns {Promise<void>} A promise that resolves when the license terms have been updated. | ||
| */ | ||
| async execute(templateId: number, payload: UpdateTemplateLicenseTermsDTO): Promise<void> { | ||
| return await this.templatesRepository.updateTemplateLicenseTerms(templateId, payload) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { UpdateTemplateMetadataDTO } from '../dtos/UpdateTemplateMetadataDTO' | ||
| import { ITemplatesRepository } from '../repositories/ITemplatesRepository' | ||
|
|
||
| export class UpdateTemplateMetadata implements UseCase<void> { | ||
| private templatesRepository: ITemplatesRepository | ||
|
|
||
| constructor(templatesRepository: ITemplatesRepository) { | ||
| this.templatesRepository = templatesRepository | ||
| } | ||
| /** | ||
| * Updates the metadata for a template with the given identifier. | ||
| * | ||
| * @param {number} templateId - The unique identifier of the template to update. | ||
| * @param {UpdateTemplateMetadataDTO} payload - The metadata to apply to the template. | ||
| * @returns {Promise<void>} A promise that resolves when the metadata has been updated. | ||
| */ | ||
| async execute( | ||
| templateId: number, | ||
| payload: UpdateTemplateMetadataDTO, | ||
| replace = false | ||
| ): Promise<void> { | ||
| return await this.templatesRepository.updateTemplateMetadata(templateId, payload, replace) | ||
| } | ||
ekraffmiller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
22 changes: 22 additions & 0 deletions
22
src/templates/domain/useCases/UpdateTemplateTermsOfAccess.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { TermsOfAccess } from '../../../datasets/domain/models/Dataset' | ||
| import { ITemplatesRepository } from '../repositories/ITemplatesRepository' | ||
|
|
||
| export class UpdateTemplateTermsOfAccess implements UseCase<void> { | ||
| private templatesRepository: ITemplatesRepository | ||
|
|
||
| constructor(templatesRepository: ITemplatesRepository) { | ||
| this.templatesRepository = templatesRepository | ||
| } | ||
|
|
||
ekraffmiller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * Updates the terms of access for a template with the given identifier. | ||
| * | ||
| * @param {number} templateId - The unique identifier of the template to update. | ||
| * @param {TermsOfAccess} termsOfAccess - The new terms of access to apply to the template. | ||
| * @returns {Promise<void>} A promise that resolves when the terms of access have been updated. | ||
| */ | ||
| async execute(templateId: number, termsOfAccess: TermsOfAccess): Promise<void> { | ||
| return await this.templatesRepository.updateTemplateTermsOfAccess(templateId, termsOfAccess) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.