diff --git a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt index b5c6db780..e03651b1f 100644 --- a/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/dto/response/PoolLegalEntityResponse.kt @@ -19,14 +19,18 @@ package org.eclipse.tractusx.bpdm.common.dto.response +import com.fasterxml.jackson.annotation.JsonUnwrapped +import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer +@JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "PoolLegalEntityResponse", description = "Legal entity record") data class PoolLegalEntityResponse( @get:Schema(description = "Legal name the partner goes by") val legalName: String, - @Schema(description = "Legal Entity") + @field:JsonUnwrapped val legalEntity: LegalEntityResponse, ) diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt index 6cdbcf9ed..c3392a82d 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/LegalEntityGateOutput.kt @@ -20,6 +20,7 @@ package org.eclipse.tractusx.bpdm.gate.api.model +import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse @@ -31,7 +32,7 @@ data class LegalEntityGateOutput( val legalNameParts: Array = emptyArray(), - @Schema(description = "Legal Entity") + @field:JsonUnwrapped val legalEntity: LegalEntityResponse, @Schema(description = "ID the record has in the external system where the record originates from") diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt index cfe6772a8..aacd35b76 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/LegalEntityService.kt @@ -22,11 +22,8 @@ package org.eclipse.tractusx.bpdm.gate.service import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressResponse -import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse -import org.eclipse.tractusx.bpdm.common.dto.saas.BusinessPartnerSaas -import org.eclipse.tractusx.bpdm.common.dto.saas.FetchResponse -import org.eclipse.tractusx.bpdm.common.exception.BpdmMappingException import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse +import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateInputResponse diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt index 25a657205..96d70fa97 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityControllerInputIT.kt @@ -62,7 +62,6 @@ internal class LegalEntityControllerInputIT @Autowired constructor( private val objectMapper: ObjectMapper, val gateClient: GateClient, private val legalEntityRepository: LegalEntityRepository, - private val testHelpers: DbTestHelpers ) { companion object { @RegisterExtension diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt index ee5abed1f..4d9884f7b 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/BusinessPartnerResponse.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response +import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse @@ -34,7 +35,7 @@ data class BusinessPartnerResponse( @get:Schema(description = "Legal name the partner goes by") val legalName: String, - @Schema(description = "Legal Entity") + @field:JsonUnwrapped val legalEntity: LegalEntityResponse, val addresses: Collection, diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt index e1dd9a46c..d67302d8d 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityMatchResponse.kt @@ -19,9 +19,13 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response +import com.fasterxml.jackson.annotation.JsonUnwrapped +import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse +import org.eclipse.tractusx.bpdm.common.service.DataClassUnwrappedJsonDeserializer +@JsonDeserialize(using = DataClassUnwrappedJsonDeserializer::class) @Schema(name = "LegalEntityMatchResponse", description = "Match with score for a business partner record of type legal entity") data class LegalEntityMatchResponse( @Schema(description = "Relative quality score of the match. The higher the better") @@ -30,6 +34,6 @@ data class LegalEntityMatchResponse( @get:Schema(description = "Legal name the partner goes by") val legalName: String, - @Schema(description = "Legal Entity") + @field:JsonUnwrapped val legalEntity: LegalEntityResponse ) diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt index f473ba586..ce71a92ac 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/LegalEntityPartnerCreateResponse.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.api.model.response +import com.fasterxml.jackson.annotation.JsonUnwrapped import com.fasterxml.jackson.databind.annotation.JsonDeserialize import io.swagger.v3.oas.annotations.media.Schema import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse @@ -31,7 +32,7 @@ data class LegalEntityPartnerCreateResponse( @get:Schema(description = "Legal name the partner goes by") val legalName: String, - @Schema(description = "Legal Entity") + @field:JsonUnwrapped val legalEntity: LegalEntityResponse, @Schema(description = "User defined index to conveniently match this entry to the corresponding entry from the request") diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt index d79ce5502..2bad56676 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt @@ -21,8 +21,6 @@ package org.eclipse.tractusx.bpdm.pool.service import org.eclipse.tractusx.bpdm.common.dto.IdentifierLsaType import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse -import org.eclipse.tractusx.bpdm.common.dto.response.LegalEntityResponse -import org.eclipse.tractusx.bpdm.common.dto.response.PoolLegalEntityResponse import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingResponse import org.eclipse.tractusx.bpdm.pool.api.model.response.BusinessPartnerResponse