Skip to content

Commit

Permalink
Merge pull request #404 from IQSS/fix/403-jsdataset-to-hierarchy
Browse files Browse the repository at this point in the history
fix: map jsDataset.id and persistentId in JSDatasetMapper.toHierarachy()
  • Loading branch information
g-saracca authored May 22, 2024
2 parents 77c0a09 + a75cd8f commit e5b6780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/dataset/infrastructure/mappers/JSDatasetMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ export class JSDatasetMapper {
jsDatasetFilesTotalOriginalDownloadSize,
jsDatasetFilesTotalArchivalDownloadSize
),
JSDatasetMapper.toHierarchy(jsDataset.persistentId, version, jsDataset.isPartOf),
JSDatasetMapper.toHierarchy(
jsDataset.id,
jsDataset.persistentId,
version,
jsDataset.isPartOf
),
undefined, // TODO: get dataset thumbnail from js-dataverse https:/IQSS/dataverse-frontend/issues/203
privateUrl,
requestedVersion
Expand Down Expand Up @@ -232,15 +237,16 @@ export class JSDatasetMapper {
}

static toHierarchy(
id: number,
persistentId: string,
version: DatasetVersion,
jsUpwardHierarchyNode: JSUpwardHierarchyNode
): UpwardHierarchyNode {
return new UpwardHierarchyNode(
version.title,
DvObjectType.DATASET,
id.toString(),
persistentId,
undefined,
version.number.toString(),
JSUpwardHierarchyNodeMapper.toUpwardHierarchyNode(jsUpwardHierarchyNode)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ const expectedDataset = {
hierarchy: new UpwardHierarchyNode(
"Darwin's Finches",
DvObjectType.DATASET,
'505',
'doi:10.5072/FK2/B4B2MJ',
undefined,
'0.0',
new UpwardHierarchyNode('Root', DvObjectType.COLLECTION, 'root')
)
Expand Down Expand Up @@ -285,8 +285,8 @@ const expectedDatasetAlternateVersion = {
hierarchy: new UpwardHierarchyNode(
"Darwin's Finches",
DvObjectType.DATASET,
'505',
'doi:10.5072/FK2/B4B2MJ',
undefined,
'0.0',
new UpwardHierarchyNode('Root', DvObjectType.COLLECTION, 'root')
)
Expand Down

0 comments on commit e5b6780

Please sign in to comment.