-
Notifications
You must be signed in to change notification settings - Fork 10
Add use case for getting dataset versions #402
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
vera
wants to merge
3
commits into
IQSS:develop
Choose a base branch
from
vera:feat/get-dataset-versions
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { DatasetLicense, DatasetMetadataBlocks, DatasetVersionState } from "./Dataset"; | ||
| import { FilePayload } from "../../../files/infra/repositories/transformers/FilePayload"; | ||
|
|
||
| export interface DatasetVersion { | ||
| id: number | ||
| datasetId: number | ||
| datasetPersistentId: string | ||
| alternativePersistentId?: string | ||
| datasetType: string | ||
| storageIdentifier: string | ||
| versionNumber?: number | ||
| versionMinorNumber?: number | ||
| internalVersionNumber: number | ||
| versionState: DatasetVersionState | ||
| isInReviewState: boolean | ||
| latestVersionPublishingState: DatasetVersionState | ||
| lastUpdateTime: string | ||
| releaseTime?: string | ||
| createTime: string | ||
| publicationDate: string | ||
| citationDate: string | ||
| license: DatasetLicense | ||
| fileAccessRequest: boolean | ||
| files?: Array<FilePayload> | ||
| metadataBlocks?: DatasetMetadataBlocks | ||
| } | ||
|
|
||
| export interface DatasetVersionSubset { | ||
| versions: DatasetVersion[] | ||
| totalCount: number | ||
| } |
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,32 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase' | ||
| import { DatasetVersionSubset } from '../models/DatasetVersion' | ||
| import { IDatasetsRepository } from '../repositories/IDatasetsRepository' | ||
|
|
||
| export class GetDatasetVersions implements UseCase<DatasetVersionSubset> { | ||
| private datasetsRepository: IDatasetsRepository | ||
|
|
||
| constructor(datasetsRepository: IDatasetsRepository) { | ||
| this.datasetsRepository = datasetsRepository | ||
| } | ||
|
|
||
| /** | ||
| * Returns a list of versions for a given dataset including (optionally) metadata blocks and files. | ||
| * Draft versions will only be available to users who have permission to view unpublished drafts. | ||
| * | ||
| * @param {number | string} [datasetId] - The dataset identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers). | ||
| * @param {number} [limit] - Limit for pagination (optional). | ||
| * @param {number} [offset] - Offset for pagination (optional). | ||
| * @param {boolean} [excludeMetadataBlocks] - Exclude metadata blocks (optional, default: false). | ||
| * @param {boolean} [excludeFiles] - Exclude files (optional, default: true). | ||
| * @returns {Promise<DatasetVersionSubset>} - A DatasetVersionSubset containing the versions and total count. | ||
| */ | ||
| async execute( | ||
| datasetId: number | string, | ||
| limit?: number, | ||
| offset?: number, | ||
| excludeMetadataBlocks?: boolean, | ||
| excludeFiles?: boolean | ||
| ): Promise<DatasetVersionSubset> { | ||
| return await this.datasetsRepository.getDatasetVersions(datasetId, limit, offset, excludeMetadataBlocks, excludeFiles) | ||
| } | ||
| } |
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
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.
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.
I think returning the complete list of files in the response could be a problem - some of our datasets have several thousand files. We have another use case, GetDatasetFiles, which returns the files with pagination. My suggestion is to remove files from the response, and use the other use case to get the files with pagination.