From f66c16d7c6d70d4681ee5da1a4c6898c112c0041 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Thu, 7 Sep 2023 16:11:03 +0200 Subject: [PATCH] feat(generic bpm): #387 Gate API: Create input endpoints for generic business partners - add enum AddressType to open api --- ...> BusinessPartnerPostalAddressInputDto.kt} | 12 ++++----- .../BusinessPartnerAddressDescription.kt | 25 +++++++++++++++++++ .../model/response/BusinessPartnerInputDto.kt | 2 +- 3 files changed, 31 insertions(+), 8 deletions(-) rename bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/{BusinessPartnerPostalAddressDto.kt => BusinessPartnerPostalAddressInputDto.kt} (78%) create mode 100644 bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/openapidescription/BusinessPartnerAddressDescription.kt diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressInputDto.kt similarity index 78% rename from bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressDto.kt rename to bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressInputDto.kt index 7302ab6cc..b4d80b583 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/BusinessPartnerPostalAddressInputDto.kt @@ -22,15 +22,13 @@ package org.eclipse.tractusx.bpdm.gate.api.model import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.AlternativePostalAddressDto import org.eclipse.tractusx.bpdm.common.dto.openapidescription.LogisticAddressDescription +import org.eclipse.tractusx.bpdm.gate.api.model.openapidescription.BusinessPartnerAddressDescription -@Schema(description = "Postal address of a business partner", requiredProperties = ["physicalPostalAddress"]) -data class BusinessPartnerPostalAddressDto( +@Schema(description = "Postal address of a input business partner", requiredProperties = ["physicalPostalAddress"]) +data class BusinessPartnerPostalAddressInputDto( - @get:Schema(name = "isLegalAddress", description = LogisticAddressDescription.isLegalAddress) - val isLegalAddress: Boolean = false, - - @get:Schema(name = "isSiteMainAddress", description = LogisticAddressDescription.isMainAddress) - val isSiteMainAddress: Boolean = false, + @get:Schema( description = BusinessPartnerAddressDescription.addressType) + val addressType: AddressType?, // TODO OpenAPI description for complex field does not work!! @get:Schema(description = LogisticAddressDescription.physicalPostalAddress) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/openapidescription/BusinessPartnerAddressDescription.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/openapidescription/BusinessPartnerAddressDescription.kt new file mode 100644 index 000000000..0523612de --- /dev/null +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/openapidescription/BusinessPartnerAddressDescription.kt @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package org.eclipse.tractusx.bpdm.gate.api.model.openapidescription + +object BusinessPartnerAddressDescription { + + const val addressType = "Type of the address" +} \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt index c61959cc8..850fa1349 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/BusinessPartnerInputDto.kt @@ -36,7 +36,7 @@ data class BusinessPartnerInputDto( override val states: Collection = emptyList(), override val classifications: Collection = emptyList(), override val roles: Collection = emptyList(), - override val postalAddress: BusinessPartnerPostalAddressDto, + override val postalAddress: BusinessPartnerPostalAddressInputDto, override val isOwner: Boolean, @get:Schema(description = CommonDescription.createdAt)