@@ -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