Skip to content

Commit

Permalink
feat: dataset image url update
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengShi-1 committed Jan 3, 2025
1 parent f2cd4eb commit 1bde9a3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/datasets/domain/models/DatasetPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export interface DatasetPreview {
publicationStatuses: PublicationStatus[]
parentCollectionName: string
parentCollectionAlias: string
imageUrl?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface DatasetPreviewPayload {
publicationStatuses: string[]
identifier_of_dataverse: string
name_of_dataverse: string
image_url?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const transformDatasetPreviewPayloadToDatasetPreview = (
description: datasetPreviewPayload.description,
publicationStatuses: publicationStatuses,
parentCollectionAlias: datasetPreviewPayload.identifier_of_dataverse,
parentCollectionName: datasetPreviewPayload.name_of_dataverse
parentCollectionName: datasetPreviewPayload.name_of_dataverse,
...(datasetPreviewPayload.image_url && {
imageUrl: datasetPreviewPayload.image_url
})
}
}
1 change: 1 addition & 0 deletions test/integration/collections/CollectionsRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ describe('CollectionsRepository', () => {
)
expect(actualDatasetPreview.parentCollectionName).toBe(expectedCollectionsName)
expect(actualDatasetPreview.type).toBe(CollectionItemType.DATASET)
expect(actualDatasetPreview.imageUrl).toBe('http://dataverse.com')

expect(actualCollectionPreview.name).toBe(expectedCollectionsName)
expect(actualCollectionPreview.alias).toBe(testSubCollectionAlias)
Expand Down
3 changes: 2 additions & 1 deletion test/testHelpers/TestConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export class TestConstants {
dsDescriptionValue: 'This is the description of the dataset.'
}
],
subject: ['Medicine, Health and Life Sciences']
subject: ['Medicine, Health and Life Sciences'],
imageUrl: 'http://dataverse.com'
}
}
]
Expand Down
6 changes: 4 additions & 2 deletions test/testHelpers/datasets/datasetPreviewHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const createDatasetPreviewModel = (): DatasetPreview => {
description: 'test',
publicationStatuses: [PublicationStatus.Draft, PublicationStatus.Unpublished],
parentCollectionAlias: 'parentCollection',
parentCollectionName: 'Parent Collection'
parentCollectionName: 'Parent Collection',
imageUrl: 'http://dataverse.com'
}
return datasetPreviewModel
}
Expand All @@ -50,6 +51,7 @@ export const createDatasetPreviewPayload = (): DatasetPreviewPayload => {
type: 'dataset',
publicationStatuses: ['Draft', 'Unpublished'],
identifier_of_dataverse: 'parentCollection',
name_of_dataverse: 'Parent Collection'
name_of_dataverse: 'Parent Collection',
image_url: 'http://dataverse.com'
}
}

0 comments on commit 1bde9a3

Please sign in to comment.