-
Notifications
You must be signed in to change notification settings - Fork 10
Add use cases for file tab data visualization #80
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4cee748
Stash: getDatasetFiles use case WIP
GPortas 3d915e7
Merge branch '71-pending-integration-tests' into 77-files-display-dat…
GPortas c9c6fbe
Added: getFilesByDatasetId use case (pending repository impl)
GPortas cd2039c
Stash: FilesRepository getFilesByDatasetId impl WIP
GPortas a835cc3
Added: file model attributes
GPortas d1f2445
Stash: files response transforming WIP
GPortas 0ef3b90
Added: files response transforming
GPortas 7f6d55a
Added: getFilesByDatasetPersistentId use case
GPortas 7cbf2f4
Changed: restricted field payload transform
GPortas 9b305ea
Stash: files repository integration test WIP (now failing)
GPortas ee2b741
Merge branch 'develop' of github.com:IQSS/dataverse-client-javascript…
GPortas f4a6bdd
Fixed: file upload via API test helper
GPortas 0111e66
Added: integration tests for FilesRepository
GPortas 7e7730c
Added: GetFileGuestbookResponsesCount use case with repository logic …
GPortas 448909b
Refactor: single GetDatasetFiles use case managing numeric and PID ids
GPortas bd59020
Refactor: single GetDataset use case managing numeric and PID ids
GPortas 44dab6a
Added: canFileBeDownloaded use case
GPortas b7ff9d1
Added: getFileThumbnailClass use case
GPortas 93e30d2
Added: getFileDataTables use case (pending repository logic)
GPortas b008283
Stash: file data table API access logic and model properties WIP
GPortas f087fc0
Added: file data table models with API access and model transform
GPortas 28a03cd
Fixed: files module exports
GPortas 03746b2
Added: getFileDataTables integration test
GPortas 378cc1e
Changed: more realistic test tab file content
GPortas 1d5fffd
Changed: GetFileDownloadCount renaming
GPortas 76104a1
Removed: GetFileThumbnailClass use case
GPortas 3e0c21e
Added: GetFileUserPermissions use case
GPortas 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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| var config = require('./jest.config'); | ||
| config.modulePathIgnorePatterns = ['<rootDir>/test/integration']; | ||
| delete config.globalSetup; | ||
| delete config.testTimeout; | ||
| console.log('RUNNING UNIT TESTS'); | ||
| module.exports = config; |
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 was deleted.
Oops, something went wrong.
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,39 @@ | ||
| export interface File { | ||
MellyGray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| id: number; | ||
| persistentId: string; | ||
| name: string; | ||
| pidURL?: string; | ||
| sizeBytes: number; | ||
| version: number; | ||
| description?: string; | ||
| restricted: boolean; | ||
| directoryLabel?: string; | ||
| datasetVersionId?: number; | ||
| categories?: string[]; | ||
| contentType: string; | ||
| embargo?: FileEmbargo; | ||
| storageIdentifier?: string; | ||
| originalFormat?: string; | ||
| originalFormatLabel?: string; | ||
| originalSize?: number; | ||
| originalName?: string; | ||
| UNF?: string; | ||
| rootDataFileId?: number; | ||
| previousDataFileId?: number; | ||
| md5?: string; | ||
| checksum?: FileChecksum; | ||
| metadataId?: number; | ||
| tabularTags?: string[]; | ||
| creationDate?: Date; | ||
| publicationDate?: Date; | ||
| } | ||
|
|
||
| export interface FileEmbargo { | ||
| dateAvailable: Date; | ||
| reason?: string; | ||
| } | ||
|
|
||
| export interface FileChecksum { | ||
| type: string; | ||
| value: string; | ||
| } | ||
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,82 @@ | ||
| export interface FileDataTable { | ||
| varQuantity?: number; | ||
| caseQuantity?: number; | ||
| recordsPerCase?: number; | ||
| UNF: string; | ||
| dataVariables: FileDataVariable[]; | ||
| } | ||
|
|
||
| export interface FileDataVariable { | ||
| id: number; | ||
| name: string; | ||
| label?: string; | ||
| weighted: boolean; | ||
| variableIntervalType?: FileDataVariableIntervalType; | ||
| variableFormatType?: FileDataVariableFormatType; | ||
| formatCategory?: string; | ||
| format?: string; | ||
| isOrderedCategorical: boolean; | ||
| fileOrder: number; | ||
| UNF: string; | ||
| fileStartPosition?: number; | ||
| fileEndPosition?: number; | ||
| recordSegmentNumber?: number; | ||
| numberOfDecimalPoints?: number; | ||
| variableMetadata?: FileDataVariableMetadata[]; | ||
| invalidRanges?: FileDataVariableInvalidRanges[]; | ||
| summaryStatistics?: object; | ||
| variableCategories?: FileDataVariableCategory[]; | ||
| } | ||
|
|
||
| export interface FileDataVariableMetadata { | ||
| id: number; | ||
| metadataId: number; | ||
| label?: string; | ||
| isWeightVar: boolean; | ||
| isWeighted: boolean; | ||
| weightVariableId?: number; | ||
| literalQuestion?: string; | ||
| interviewInstruction?: string; | ||
| postQuestion?: string; | ||
| universe?: string; | ||
| notes?: string; | ||
| categoryMetadatas: FileDataVariableCategoryMetadata[]; | ||
| } | ||
|
|
||
| export interface FileDataVariableCategoryMetadata { | ||
| wFreq?: number; | ||
| categoryValue?: string; | ||
| } | ||
|
|
||
| export interface FileDataVariableInvalidRanges { | ||
| beginValue?: string; | ||
| hasBeginValueType: boolean; | ||
| isBeginValueTypePoint: boolean; | ||
| isBeginValueTypeMin: boolean; | ||
| isBeginValueTypeMinExcl: boolean; | ||
| isBeginValueTypeMax: boolean; | ||
| isBeginValueTypeMaxExcl: boolean; | ||
| endValue?: string; | ||
| hasEndValueType: boolean; | ||
| endValueTypeMax: boolean; | ||
| endValueTypeMaxExcl: boolean; | ||
| } | ||
|
|
||
| export interface FileDataVariableCategory { | ||
| label?: string; | ||
| value?: string; | ||
| isMissing: boolean; | ||
| frequency?: number; | ||
| } | ||
|
|
||
| export enum FileDataVariableIntervalType { | ||
| DISCRETE = 'discrete', | ||
| CONTIN = 'contin', | ||
| NOMINAL = 'nominal', | ||
| DICHOTOMOUS = 'dichotomous', | ||
| } | ||
|
|
||
| export enum FileDataVariableFormatType { | ||
| NUMERIC = 'NUMERIC', | ||
| CHARACTER = 'CHARACTER', | ||
| } |
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,8 @@ | ||
| export enum FileOrderCriteria { | ||
| NAME_AZ = 'NameAZ', | ||
| NAME_ZA = 'NameZA', | ||
| NEWEST = 'Newest', | ||
| OLDEST = 'Oldest', | ||
| SIZE = 'Size', | ||
| TYPE = 'Type', | ||
| } |
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,4 @@ | ||
| export interface FileUserPermissions { | ||
| canDownloadFile: boolean; | ||
| canEditOwnerDataset: boolean; | ||
| } |
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,20 @@ | ||
| import { FileOrderCriteria } from '../models/FileOrderCriteria'; | ||
| import { File } from '../models/File'; | ||
| import { FileDataTable } from '../models/FileDataTable'; | ||
| import { FileUserPermissions } from '../models/FileUserPermissions'; | ||
|
|
||
| export interface IFilesRepository { | ||
| getDatasetFiles( | ||
| datasetId: number | string, | ||
| datasetVersionId?: string, | ||
| limit?: number, | ||
| offset?: number, | ||
| orderCriteria?: FileOrderCriteria, | ||
| ): Promise<File[]>; | ||
|
|
||
| getFileDownloadCount(fileId: number | string): Promise<number>; | ||
|
|
||
| getFileUserPermissions(fileId: number | string): Promise<FileUserPermissions>; | ||
|
|
||
| getFileDataTables(fileId: number | string): Promise<FileDataTable[]>; | ||
| } |
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 { FileOrderCriteria } from '../models/FileOrderCriteria'; | ||
| import { IFilesRepository } from '../repositories/IFilesRepository'; | ||
| import { File } from '../models/File'; | ||
|
|
||
| export class GetDatasetFiles implements UseCase<File[]> { | ||
| private filesRepository: IFilesRepository; | ||
|
|
||
| constructor(filesRepository: IFilesRepository) { | ||
| this.filesRepository = filesRepository; | ||
| } | ||
|
|
||
| async execute( | ||
| datasetId: number | string, | ||
| datasetVersionId?: string, | ||
| limit?: number, | ||
| offset?: number, | ||
| orderCriteria?: FileOrderCriteria, | ||
| ): Promise<File[]> { | ||
| return await this.filesRepository.getDatasetFiles(datasetId, datasetVersionId, limit, offset, orderCriteria); | ||
| } | ||
| } |
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,15 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase'; | ||
| import { IFilesRepository } from '../repositories/IFilesRepository'; | ||
| import { FileDataTable } from '../models/FileDataTable'; | ||
|
|
||
| export class GetFileDataTables implements UseCase<FileDataTable[]> { | ||
| private filesRepository: IFilesRepository; | ||
|
|
||
| constructor(filesRepository: IFilesRepository) { | ||
| this.filesRepository = filesRepository; | ||
| } | ||
|
|
||
| async execute(fileId: number | string): Promise<FileDataTable[]> { | ||
| return await this.filesRepository.getFileDataTables(fileId); | ||
| } | ||
| } |
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,14 @@ | ||
| import { UseCase } from '../../../core/domain/useCases/UseCase'; | ||
| import { IFilesRepository } from '../repositories/IFilesRepository'; | ||
|
|
||
| export class GetFileDownloadCount implements UseCase<number> { | ||
| private filesRepository: IFilesRepository; | ||
|
|
||
| constructor(filesRepository: IFilesRepository) { | ||
| this.filesRepository = filesRepository; | ||
| } | ||
|
|
||
| async execute(fileId: number | string): Promise<number> { | ||
| return await this.filesRepository.getFileDownloadCount(fileId); | ||
| } | ||
| } |
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.