Skip to content

Commit 1913993

Browse files
authored
Merge pull request #199 from IQSS/194-isReleased-to-DvObjectOwnerNode
Add isReleased to collection DvObjectOwnerNode.
2 parents b202fb0 + f80f74d commit 1913993

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

src/core/domain/models/DvObjectOwnerNode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface DvObjectOwnerNode {
44
identifier: string
55
persistentIdentifier?: string
66
version?: string
7+
isReleased?: boolean
78
isPartOf?: DvObjectOwnerNode
89
}
910

src/core/infra/repositories/transformers/OwnerNodePayload.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export interface OwnerNodePayload {
44
identifier: string
55
persistentIdentifier?: string
66
version?: string
7+
isReleased?: boolean
78
isPartOf?: OwnerNodePayload
89
}

src/core/infra/repositories/transformers/dvObjectOwnerNodeTransformer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const transformPayloadToOwnerNode = (
1212
persistentIdentifier: ownerNodePayload.persistentIdentifier
1313
}),
1414
...(ownerNodePayload.version && { version: ownerNodePayload.version }),
15+
...(ownerNodePayload.isReleased !== undefined && { isReleased: ownerNodePayload.isReleased }),
1516
...(ownerNodePayload.isPartOf && {
1617
isPartOf: transformPayloadToOwnerNode(ownerNodePayload.isPartOf)
1718
})

test/environment/.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
POSTGRES_VERSION=13
22
DATAVERSE_DB_USER=dataverse
33
SOLR_VERSION=9.3.0
4-
DATAVERSE_IMAGE_REGISTRY=ghcr.io
5-
DATAVERSE_IMAGE_TAG=10857-add-expiration-date-to-recreate-token-api
4+
DATAVERSE_IMAGE_REGISTRY=docker.io
5+
DATAVERSE_IMAGE_TAG=unstable
66
DATAVERSE_BOOTSTRAP_TIMEOUT=5m

test/integration/collections/CollectionsRepository.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ describe('CollectionsRepository', () => {
148148
expect(createdCollection.isPartOf.type).toBe('DATAVERSE')
149149
expect(createdCollection.isPartOf.displayName).toBe('Root')
150150
expect(createdCollection.isPartOf.identifier).toBe('root')
151+
expect(createdCollection.isPartOf.isReleased).toBe(true)
151152

152153
expect(createdCollection.inputLevels?.length).toBe(1)
153154
const inputLevel = createdCollection.inputLevels?.[0]

test/integration/datasets/DatasetsRepository.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,35 @@ describe('DatasetsRepository', () => {
246246
).rejects.toThrow(expectedError)
247247
})
248248
})
249+
250+
describe('returns correct isPartOf properties', () => {
251+
test('should return isPartOf property correctly when dataset is part of an unpublished collection', async () => {
252+
const isPartOfTestCollectionAlias = 'isPartOfTestCollection'
253+
254+
const { alias: createdCollectionAlias } = await createCollectionViaApi(
255+
isPartOfTestCollectionAlias
256+
)
257+
258+
const { numericId: createdDatasetNumericId } = await createDataset.execute(
259+
TestConstants.TEST_NEW_DATASET_DTO,
260+
createdCollectionAlias
261+
)
262+
263+
const actual = await sut.getDataset(
264+
createdDatasetNumericId,
265+
DatasetNotNumberedVersion.LATEST,
266+
false
267+
)
268+
269+
expect(actual.id).toBe(createdDatasetNumericId)
270+
expect(actual.isPartOf.type).toBe('DATAVERSE')
271+
expect(actual.isPartOf.identifier).toBe(isPartOfTestCollectionAlias)
272+
expect(actual.isPartOf.isReleased).toBe(false)
273+
274+
await deleteUnpublishedDatasetViaApi(createdDatasetNumericId)
275+
await deleteCollectionViaApi(isPartOfTestCollectionAlias)
276+
})
277+
})
249278
})
250279

251280
describe('Private URLs', () => {

0 commit comments

Comments
 (0)