From 2b2b0159d958f35a4c5794525b061ccd20d0ebf8 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Tue, 5 Sep 2023 07:54:40 +0200 Subject: [PATCH] feat(generic bpm): #384 Gate API: Create input endpoints for generic business partners - Comments from the review incorporated --- .../tractusx/bpdm/gate/api/GateBusinessPartnerApi.kt | 10 +++++----- .../gate/api/model/BusinessPartnerIdentifierDto.kt | 2 +- .../gate/api/model/IBaseBusinessPartnerInputDto.kt | 12 ++++++------ ...nputResponseDto.kt => BusinessPartnerInputDto.kt} | 2 +- .../gate/controller/BusinessPartnerController.kt | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) rename bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/{BusinessPartnerInputResponseDto.kt => BusinessPartnerInputDto.kt} (97%) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateBusinessPartnerApi.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateBusinessPartnerApi.kt index e00b63895..52bc8d94b 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateBusinessPartnerApi.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateBusinessPartnerApi.kt @@ -27,7 +27,7 @@ import jakarta.validation.Valid import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.gate.api.model.request.BusinessPartnerInputRequest -import org.eclipse.tractusx.bpdm.gate.api.model.response.BusinessPartnerInputResponseDto +import org.eclipse.tractusx.bpdm.gate.api.model.response.BusinessPartnerInputDto import org.springdoc.core.annotations.ParameterObject import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping @@ -45,8 +45,8 @@ interface GateBusinessPartnerApi { @Operation( summary = "Create or update business partner with given external ID", description = "Create or update generic business partner. " + - "Updates instead of creating a new business partner if an already existing external id is used. " + - "The same external id may not occur more than once in a single request. " + + "Updates instead of creating a new business partner if an already existing external ID is used. " + + "The same external ID may not occur more than once in a single request. " + "For a single request, the maximum number of business partners in the request is limited to \${bpdm.api.upsert-limit} entries." ) @ApiResponses( @@ -57,7 +57,7 @@ interface GateBusinessPartnerApi { ) @PutMapping("/input/business-partners") @PutExchange("/input/business-partners") - fun upsertBusinessPartnersInput(@RequestBody businessPartners: Collection): Collection + fun upsertBusinessPartnersInput(@RequestBody businessPartners: Collection): Collection @Operation( summary = "Search business partner by external ID. An empty external ID list returns a paginated list of all business partners.", @@ -74,6 +74,6 @@ interface GateBusinessPartnerApi { fun getBusinessPartnersInputByExternalIds( @ParameterObject @Valid paginationRequest: PaginationRequest, @RequestBody externalIds: Collection - ): PageDto + ): PageDto } \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerIdentifierDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerIdentifierDto.kt index 813fcf2f4..f28a3c4e6 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerIdentifierDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerIdentifierDto.kt @@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema data class BusinessPartnerIdentifierDto( @get:Schema(description = "Value of the identifier") - val value: String, + val value: String?, @get:Schema(description = "Technical key of the type to which this identifier belongs to") val type: String, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/IBaseBusinessPartnerInputDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/IBaseBusinessPartnerInputDto.kt index 04e23fa12..12de7271b 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/IBaseBusinessPartnerInputDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/IBaseBusinessPartnerInputDto.kt @@ -22,12 +22,12 @@ package org.eclipse.tractusx.bpdm.gate.api.model import io.swagger.v3.oas.annotations.media.ArraySchema import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.ClassificationDto -import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LegalEntityDescription +import org.eclipse.tractusx.bpdm.common.dto.openapidescription.CommonDescription interface IBaseBusinessPartnerInputDto { - @get:Schema(description = "ID the record has in the external system where the record originates from") + @get:Schema(description = CommonDescription.externalId) val externalId: String @get:Schema(description = "") @@ -36,16 +36,16 @@ interface IBaseBusinessPartnerInputDto { @get:Schema(description = "Abbreviated name or shorthand") val shortName: String? - @get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.identifiers)) + @get:ArraySchema(arraySchema = Schema(description = "The list of identifiers of the business partner")) val identifiers: Collection @get:Schema(description = "Technical key of the legal form") val legalForm: String? - @get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.states)) + @get:ArraySchema(arraySchema = Schema(description = "The list of (temporary) states of the business partner.")) val states: Collection - @get:ArraySchema(arraySchema = Schema(description = LegalEntityDescription.classifications)) + @get:ArraySchema(arraySchema = Schema(description = "The list of classifications of the legal entity, such as a specific industry.")) val classifications: Collection @get:Schema(description = "Which roles this business partner takes in relation to the sharing member") @@ -54,7 +54,7 @@ interface IBaseBusinessPartnerInputDto { @get:Schema(description = "") val isOwner: Boolean - @get:Schema(description = "Address of the official seat of this legal entity") + @get:Schema(description = "Address of the official seat of this business partner") val postalAddress: BusinessPartnerPostalAddressDto diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputResponseDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt similarity index 97% rename from bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputResponseDto.kt rename to bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt index 02636a631..c61959cc8 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputResponseDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt @@ -27,7 +27,7 @@ import java.time.Instant @Schema(description = "Generic business partner with external id", requiredProperties = ["externalId", "postalAddress"]) -data class BusinessPartnerInputResponseDto( +data class BusinessPartnerInputDto( override val externalId: String, override val nameParts: List = emptyList(), override val shortName: String?, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerController.kt index 07ec2c102..ba3cbb89c 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/BusinessPartnerController.kt @@ -23,20 +23,20 @@ import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.gate.api.GateBusinessPartnerApi import org.eclipse.tractusx.bpdm.gate.api.model.request.BusinessPartnerInputRequest -import org.eclipse.tractusx.bpdm.gate.api.model.response.BusinessPartnerInputResponseDto +import org.eclipse.tractusx.bpdm.gate.api.model.response.BusinessPartnerInputDto import org.springframework.web.bind.annotation.RestController @RestController class BusinessPartnerController() : GateBusinessPartnerApi { - override fun upsertBusinessPartnersInput(businessPartners: Collection): Collection { + override fun upsertBusinessPartnersInput(businessPartners: Collection): Collection { TODO("Not yet implemented") } override fun getBusinessPartnersInputByExternalIds( paginationRequest: PaginationRequest, externalIds: Collection - ): PageDto { + ): PageDto { TODO("Not yet implemented") } } \ No newline at end of file