Skip to content

Commit 8e5c736

Browse files
committed
Refactor: code styling
1 parent 65a2103 commit 8e5c736

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

src/collections/infra/repositories/CollectionsRepository.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,18 @@ export class CollectionsRepository extends ApiRepository implements ICollections
5353
})
5454
)
5555

56-
const inputLevelsRequestBody: NewCollectionInputLevelRequestPayload[] = []
57-
collectionDTO.inputLevels.forEach((element) => {
58-
inputLevelsRequestBody.push({
59-
datasetFieldTypeName: element.datasetFieldName,
60-
include: element.include,
61-
required: element.required
62-
})
63-
})
56+
const inputLevelsRequestBody: NewCollectionInputLevelRequestPayload[] =
57+
collectionDTO.inputLevels.map((inputLevel) => ({
58+
datasetFieldTypeName: inputLevel.datasetFieldName,
59+
include: inputLevel.include,
60+
required: inputLevel.required
61+
}))
6462

6563
const requestBody: NewCollectionRequestPayload = {
6664
alias: collectionDTO.alias,
6765
name: collectionDTO.name,
6866
dataverseContacts: dataverseContacts,
69-
dataverseType: collectionDTO.type.toString(),
67+
dataverseType: collectionDTO.type,
7068
metadataBlocks: {
7169
metadataBlockNames: collectionDTO.metadataBlockNames,
7270
facetIds: collectionDTO.facetIds,

src/collections/infra/repositories/transformers/collectionTransformers.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ const transformPayloadToCollection = (collectionPayload: CollectionPayload): Col
3232
const transformInputLevelsPayloadToInputLevels = (
3333
inputLevelsPayload: CollectionInputLevelPayload[]
3434
): CollectionInputLevel[] => {
35-
const collectionInputLevels: CollectionInputLevel[] = []
36-
inputLevelsPayload.forEach((element) => {
37-
collectionInputLevels.push({
38-
datasetFieldName: element.datasetFieldTypeName,
39-
include: element.include,
40-
required: element.required
41-
})
42-
})
43-
return collectionInputLevels
35+
return inputLevelsPayload.map((inputLevel) => ({
36+
datasetFieldName: inputLevel.datasetFieldTypeName,
37+
include: inputLevel.include,
38+
required: inputLevel.required
39+
}))
4440
}

0 commit comments

Comments
 (0)