Skip to content

Commit 8c614e7

Browse files
committed
feat: temporary changes to test use cases
1 parent 1eda9da commit 8c614e7

File tree

5 files changed

+502
-249
lines changed

5 files changed

+502
-249
lines changed

src/collections/domain/dtos/CollectionDTO.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface CollectionDTO {
1010
metadataBlockNames?: string[]
1111
facetIds?: string[]
1212
inputLevels?: CollectionInputLevelDTO[]
13+
inheritMetadataBlocksFromParent: boolean
14+
inheritFacetsFromParent: boolean
1315
}
1416

1517
export interface CollectionInputLevelDTO {

src/collections/infra/repositories/CollectionsRepository.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,27 +190,46 @@ export class CollectionsRepository extends ApiRepository implements ICollections
190190

191191
const metadataBlocksRequestBody: NewCollectionMetadataBlocksRequestPayload = {}
192192

193-
if (collectionDTO.metadataBlockNames && collectionDTO.inputLevels) {
193+
if (collectionDTO.inheritMetadataBlocksFromParent) {
194+
metadataBlocksRequestBody['inheritMetadataBlocksFromParent'] = true
195+
} else {
194196
metadataBlocksRequestBody['metadataBlockNames'] = collectionDTO.metadataBlockNames
195197
metadataBlocksRequestBody['inputLevels'] = inputLevelsRequestBody
196-
} else {
197-
metadataBlocksRequestBody['inheritMetadataBlocksFromParent'] = true
198198
}
199199

200-
if (collectionDTO.facetIds) {
201-
metadataBlocksRequestBody['facetIds'] = collectionDTO.facetIds
202-
} else {
200+
if (collectionDTO.inheritFacetsFromParent) {
203201
metadataBlocksRequestBody['inheritFacetsFromParent'] = true
202+
} else {
203+
metadataBlocksRequestBody['facetIds'] = collectionDTO.facetIds
204204
}
205205

206+
// if (collectionDTO.metadataBlockNames && collectionDTO.inputLevels) {
207+
// metadataBlocksRequestBody['metadataBlockNames'] = collectionDTO.metadataBlockNames
208+
// metadataBlocksRequestBody['inputLevels'] = inputLevelsRequestBody
209+
// } else {
210+
// metadataBlocksRequestBody['inheritMetadataBlocksFromParent'] = true
211+
// }
212+
213+
// if (collectionDTO.facetIds) {
214+
// metadataBlocksRequestBody['facetIds'] = collectionDTO.facetIds
215+
// } else {
216+
// metadataBlocksRequestBody['inheritFacetsFromParent'] = true
217+
// }
218+
206219
return {
207220
alias: collectionDTO.alias,
208221
name: collectionDTO.name,
209222
dataverseContacts: dataverseContacts,
210223
dataverseType: collectionDTO.type,
211224
...(collectionDTO.description && { description: collectionDTO.description }),
212225
...(collectionDTO.affiliation && { affiliation: collectionDTO.affiliation }),
213-
metadataBlocks: metadataBlocksRequestBody
226+
metadataBlocks: {
227+
metadataBlockNames: collectionDTO.metadataBlockNames,
228+
facetIds: collectionDTO.facetIds,
229+
inputLevels: inputLevelsRequestBody,
230+
inheritFacetsFromParent: metadataBlocksRequestBody.inheritFacetsFromParent,
231+
inheritMetadataBlocksFromParent: metadataBlocksRequestBody.inheritMetadataBlocksFromParent
232+
}
214233
}
215234
}
216235

0 commit comments

Comments
 (0)