From 46b0af0597bc9e88c00d72e7d5c5ddb4a34b7869 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Wed, 5 Jul 2023 08:41:24 +0200 Subject: [PATCH 1/2] fix(api): API-Model: Rename DTOs #268 - rename remaining dtos --- .../bridge/dummy/dto/GateLegalEntityInfo.kt | 4 +- .../bridge/dummy/service/GateQueryService.kt | 4 +- .../tractusx/bpdm/gate/api/GateAddressApi.kt | 8 +- .../bpdm/gate/api/GateChangelogApi.kt | 6 +- ...nputResponse.kt => AddressGateInputDto.kt} | 2 +- .../model/response/LegalEntityGateInputDto.kt | 2 +- .../model/response/PageChangeLogResponse.kt | 43 --------- .../api/model/response/SiteGateInputDto.kt | 2 +- .../bpdm/gate/controller/AddressController.kt | 8 +- .../gate/controller/ChangelogController.kt | 6 +- .../bpdm/gate/service/AddressService.kt | 8 +- .../bpdm/gate/service/ChangelogService.kt | 6 +- .../bpdm/gate/service/ResponseMappings.kt | 4 +- .../tractusx/bpdm/gate/util/ResponseValues.kt | 16 ++-- .../bpdm/pool/api/PoolChangelogApi.kt | 4 +- ...esponse.kt => ChangelogEntryVerboseDto.kt} | 2 +- .../pool/controller/ChangelogController.kt | 4 +- .../pool/service/PartnerChangelogService.kt | 2 +- .../bpdm/pool/service/ResponseMappings.kt | 4 +- .../pool/controller/ChangelogControllerIT.kt | 88 +++++++++---------- 20 files changed, 90 insertions(+), 133 deletions(-) rename bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/{AddressGateInputResponse.kt => AddressGateInputDto.kt} (98%) delete mode 100644 bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogResponse.kt rename bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/{ChangelogEntryResponse.kt => ChangelogEntryVerboseDto.kt} (97%) diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt index 2792ffe70..561c25e6e 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/dto/GateLegalEntityInfo.kt @@ -20,12 +20,12 @@ package com.catenax.bpdm.bridge.dummy.dto import org.eclipse.tractusx.bpdm.common.dto.LegalEntityDto -import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputDto data class GateLegalEntityInfo( val legalNameParts: List = emptyList(), val legalEntity: LegalEntityDto, - val legalAddress: AddressGateInputResponse, + val legalAddress: AddressGateInputDto, val externalId: String, val bpn: String? ) diff --git a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt index 925a2b656..f43ecddba 100644 --- a/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt +++ b/bpdm-bridge-dummy/src/main/kotlin/com/catenax/bpdm/bridge/dummy/service/GateQueryService.kt @@ -180,13 +180,13 @@ class GateQueryService( return validContent } - private fun getAddressesInput(externalIds: Set): Collection { + private fun getAddressesInput(externalIds: Set): Collection { if (externalIds.isEmpty()) { return emptyList() } var page = 0 - val validContent = mutableListOf() + val validContent = mutableListOf() do { val pageResponse = gateClient.addresses().getAddressesByExternalIds( diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateAddressApi.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateAddressApi.kt index 5bc449022..c5c0b1b79 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateAddressApi.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateAddressApi.kt @@ -29,7 +29,7 @@ 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.AddressGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateOutputRequest -import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputDto import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateOutputDto import org.springdoc.core.annotations.ParameterObject import org.springframework.http.MediaType @@ -76,7 +76,7 @@ interface GateAddressApi { @GetMapping("/input/addresses/{externalId}") @GetExchange("/input/addresses/{externalId}") - fun getAddressByExternalId(@Parameter(description = "External identifier") @PathVariable externalId: String): AddressGateInputResponse + fun getAddressByExternalId(@Parameter(description = "External identifier") @PathVariable externalId: String): AddressGateInputDto @Operation( summary = "Get page of addresses filtered by a collection of externalIds", @@ -93,7 +93,7 @@ interface GateAddressApi { fun getAddressesByExternalIds( @ParameterObject @Valid paginationRequest: PaginationRequest, @RequestBody externalIds: Collection - ): PageDto + ): PageDto @Operation( @@ -108,7 +108,7 @@ interface GateAddressApi { ) @GetMapping("/input/addresses") @GetExchange("/input/addresses") - fun getAddresses(@ParameterObject @Valid paginationRequest: PaginationRequest): PageDto + fun getAddresses(@ParameterObject @Valid paginationRequest: PaginationRequest): PageDto @Operation( summary = "Get page of addresses (Output)", diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt index ebaad096d..cad9a1c5c 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/GateChangelogApi.kt @@ -27,7 +27,7 @@ import jakarta.validation.Valid import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto -import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.springdoc.core.annotations.ParameterObject import org.springframework.http.MediaType import org.springframework.web.bind.annotation.* @@ -54,7 +54,7 @@ interface GateChangelogApi { fun getInputChangelog( @ParameterObject @Valid paginationRequest: PaginationRequest, @RequestBody searchRequest: ChangeLogSearchRequest - ): PageChangeLogResponse + ): PageChangeLogDto @Operation( @@ -72,5 +72,5 @@ interface GateChangelogApi { fun getOutputChangelog( @ParameterObject @Valid paginationRequest: PaginationRequest, @RequestBody searchRequest: ChangeLogSearchRequest - ): PageChangeLogResponse + ): PageChangeLogDto } \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputDto.kt similarity index 98% rename from bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputResponse.kt rename to bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputDto.kt index 9ff941211..86a79609a 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputResponse.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/AddressGateInputDto.kt @@ -30,7 +30,7 @@ import org.eclipse.tractusx.bpdm.gate.api.model.LogisticAddressGateDto name = "AddressGateInputDto", description = "Address with legal entity or site references. " + "Only one of either legal entity or site external id can be set for an address." ) -data class AddressGateInputResponse( +data class AddressGateInputDto( @field:JsonUnwrapped val address: LogisticAddressGateDto, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LegalEntityGateInputDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LegalEntityGateInputDto.kt index 95ee8f299..b5e33d204 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LegalEntityGateInputDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/LegalEntityGateInputDto.kt @@ -39,7 +39,7 @@ data class LegalEntityGateInputDto( val roles: Collection = emptyList(), @get:Schema(description = "Address of the official seat of this legal entity") - val legalAddress: AddressGateInputResponse, + val legalAddress: AddressGateInputDto, @Schema(description = "ID the record has in the external system where the record originates from", required = true) val externalId: String, diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogResponse.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogResponse.kt deleted file mode 100644 index bd6b02705..000000000 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogResponse.kt +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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.response - -import io.swagger.v3.oas.annotations.media.Schema -import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError - - -@Schema(description = "Paginated collection of results") -data class PageChangeLogResponse( - @Schema(description = "Total number of all results in all pages") - val totalElements: Long, - @Schema(description = "Total number pages") - val totalPages: Int, - @Schema(description = "Current page number") - val page: Int, - @Schema(description = "Number of results in the page") - val contentSize: Int, - @Schema(description = "Collection of results in the page") - val content: Collection, - @Schema(description = "Number of entries in the page that have been omitted due to being invalid (error)") - val invalidEntries: Int, - @Schema(description = "Infos about the entries with errors") - val errors: Collection>, -) - diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SiteGateInputDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SiteGateInputDto.kt index 87f0722fb..587463330 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SiteGateInputDto.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/SiteGateInputDto.kt @@ -35,7 +35,7 @@ data class SiteGateInputDto( val site: SiteGateDto, @get:Schema(description = "Main address where this site resides") - val mainAddress: AddressGateInputResponse, + val mainAddress: AddressGateInputDto, @Schema(description = "ID the record has in the external system where the record originates from") val externalId: String, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt index b8c64fad7..04094d5fc 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt @@ -24,7 +24,7 @@ import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.gate.api.GateAddressApi import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateOutputRequest -import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputDto import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateOutputDto import org.eclipse.tractusx.bpdm.gate.config.ApiConfigProperties import org.eclipse.tractusx.bpdm.gate.containsDuplicates @@ -58,7 +58,7 @@ class AddressController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") - override fun getAddressByExternalId(externalId: String): AddressGateInputResponse { + override fun getAddressByExternalId(externalId: String): AddressGateInputDto { return addressService.getAddressByExternalId(externalId) } @@ -67,12 +67,12 @@ class AddressController( override fun getAddressesByExternalIds( paginationRequest: PaginationRequest, externalIds: Collection - ): PageDto { + ): PageDto { return addressService.getAddresses(page = paginationRequest.page, size = paginationRequest.size, externalIds = externalIds) } @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") - override fun getAddresses(paginationRequest: PaginationRequest): PageDto { + override fun getAddresses(paginationRequest: PaginationRequest): PageDto { return addressService.getAddresses(page = paginationRequest.page, size = paginationRequest.size) } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt index fd67500b4..240438cf7 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt @@ -24,7 +24,7 @@ import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.gate.api.GateChangelogApi import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto -import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.eclipse.tractusx.bpdm.gate.service.ChangelogService import org.springframework.security.access.prepost.PreAuthorize import org.springframework.validation.annotation.Validated @@ -39,7 +39,7 @@ class ChangelogController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") override fun getInputChangelog( paginationRequest: PaginationRequest, searchRequest: ChangeLogSearchRequest - ): PageChangeLogResponse { + ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, searchRequest.lsaTypes, @@ -54,7 +54,7 @@ class ChangelogController( override fun getOutputChangelog( paginationRequest: PaginationRequest, searchRequest: ChangeLogSearchRequest - ): PageChangeLogResponse { + ): PageChangeLogDto { return changelogService.getChangeLogEntries( searchRequest.externalIds, searchRequest.lsaTypes, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt index 9dc82ac0c..3444b577e 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/AddressService.kt @@ -26,7 +26,7 @@ import org.eclipse.tractusx.bpdm.common.model.OutputInputEnum import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateInputRequest import org.eclipse.tractusx.bpdm.gate.api.model.request.AddressGateOutputRequest -import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateInputDto import org.eclipse.tractusx.bpdm.gate.api.model.response.AddressGateOutputDto import org.eclipse.tractusx.bpdm.gate.config.BpnConfigProperties import org.eclipse.tractusx.bpdm.gate.entity.ChangelogEntry @@ -46,7 +46,7 @@ class AddressService( ) { private val logger = KotlinLogging.logger { } - fun getAddresses(page: Int, size: Int, externalIds: Collection? = null): PageDto { + fun getAddresses(page: Int, size: Int, externalIds: Collection? = null): PageDto { val logisticAddressPage = if (externalIds != null) { addressRepository.findByExternalIdInAndDataType(externalIds, OutputInputEnum.Input, PageRequest.of(page, size)) @@ -63,13 +63,13 @@ class AddressService( ) } - private fun toValidLogisticAddresses(logisticAddressPage: Page): List { + private fun toValidLogisticAddresses(logisticAddressPage: Page): List { return logisticAddressPage.content.map { logisticAddress -> logisticAddress.toAddressGateInputResponse(logisticAddress) } } - fun getAddressByExternalId(externalId: String): AddressGateInputResponse { + fun getAddressByExternalId(externalId: String): AddressGateInputDto { val logisticAddress = addressRepository.findByExternalIdAndDataType(externalId, OutputInputEnum.Input) ?: throw BpdmNotFoundException("Logistic Address", externalId) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt index 862fa6787..be6a7d2f0 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt @@ -24,7 +24,7 @@ import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogGateDto import org.eclipse.tractusx.bpdm.gate.api.model.response.ErrorInfo -import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogResponse +import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogDto import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byCreatedAtGreaterThan import org.eclipse.tractusx.bpdm.gate.repository.ChangelogRepository.Specs.byExternalIdsIn @@ -45,7 +45,7 @@ class ChangelogService(private val changelogRepository: ChangelogRepository) { outputInputEnum: OutputInputEnum?, page: Int, pageSize: Int - ): PageChangeLogResponse { + ): PageChangeLogDto { val nonNullExternalIds = externalIds ?: emptySet() @@ -74,7 +74,7 @@ class ChangelogService(private val changelogRepository: ChangelogRepository) { } - return PageChangeLogResponse( + return PageChangeLogDto( page = page, totalElements = pageDto.totalElements, totalPages = pageDto.totalPages, contentSize = pageDto.content.size, diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt index 6e7f3ce47..f6b76acf3 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ResponseMappings.kt @@ -267,9 +267,9 @@ fun getMainAddressForLegalEntityExternalId(siteExternalId: String): String { } //Logistic Address mapping to AddressGateInputResponse -fun LogisticAddress.toAddressGateInputResponse(logisticAddressPage: LogisticAddress): AddressGateInputResponse { +fun LogisticAddress.toAddressGateInputResponse(logisticAddressPage: LogisticAddress): AddressGateInputDto { - val addressGateInputResponse = AddressGateInputResponse( + val addressGateInputResponse = AddressGateInputDto( address = logisticAddressPage.toLogisticAddressDto(), externalId = externalId, legalEntityExternalId = legalEntity?.externalId, diff --git a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt index 1fef14c67..eaffac060 100644 --- a/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt +++ b/bpdm-gate/src/test/kotlin/org/eclipse/tractusx/bpdm/gate/util/ResponseValues.kt @@ -271,7 +271,7 @@ object ResponseValues { updatedAt = CommonValues.now, ) - val addressGateInputResponse1 = AddressGateInputResponse( + val addressGateInputResponse1 = AddressGateInputDto( address = RequestValues.address1 .copy( nameParts = listOf(CommonValues.name1), @@ -280,7 +280,7 @@ object ResponseValues { legalEntityExternalId = CommonValues.externalId1, ) - val addressGateInputResponse2 = AddressGateInputResponse( + val addressGateInputResponse2 = AddressGateInputDto( address = RequestValues.address2 .copy( nameParts = listOf(CommonValues.nameSite1), @@ -289,7 +289,7 @@ object ResponseValues { siteExternalId = CommonValues.externalIdSite1, ) - val logisticAddressGateInputResponse1 = AddressGateInputResponse( + val logisticAddressGateInputResponse1 = AddressGateInputDto( address = RequestValues.logisticAddress1.copy( nameParts = listOf(CommonValues.name1), ), @@ -297,7 +297,7 @@ object ResponseValues { legalEntityExternalId = null, ) - val logisticAddressGateInputResponse2 = AddressGateInputResponse( + val logisticAddressGateInputResponse2 = AddressGateInputDto( address = RequestValues.logisticAddress2.copy( nameParts = listOf(CommonValues.name2), ), @@ -327,7 +327,7 @@ object ResponseValues { val legalEntityGateInputResponse1 = LegalEntityGateInputDto( legalEntity = RequestValues.legalEntity1, legalNameParts = listOf(CommonValues.name1), - legalAddress = AddressGateInputResponse( + legalAddress = AddressGateInputDto( address = RequestValues.logisticAddress1, externalId = "${CommonValues.externalId1}_legalAddress", legalEntityExternalId = CommonValues.externalId1, @@ -339,7 +339,7 @@ object ResponseValues { val legalEntityGateInputResponse2 = LegalEntityGateInputDto( legalEntity = RequestValues.legalEntity2, legalNameParts = listOf(CommonValues.name2), - legalAddress = AddressGateInputResponse( + legalAddress = AddressGateInputDto( address = RequestValues.logisticAddress2, externalId = "${CommonValues.externalId2}_legalAddress", legalEntityExternalId = CommonValues.externalId2, @@ -382,7 +382,7 @@ object ResponseValues { site = RequestValues.site1, externalId = CommonValues.externalIdSite1, legalEntityExternalId = CommonValues.externalId1, - mainAddress = AddressGateInputResponse( + mainAddress = AddressGateInputDto( address = RequestValues.address1, externalId = "${CommonValues.externalIdSite1}_site", legalEntityExternalId = null, @@ -394,7 +394,7 @@ object ResponseValues { site = RequestValues.site2, externalId = CommonValues.externalIdSite2, legalEntityExternalId = CommonValues.externalId2, - mainAddress = AddressGateInputResponse( + mainAddress = AddressGateInputDto( address = RequestValues.address2, externalId = "${CommonValues.externalIdSite2}_site", legalEntityExternalId = null, diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolChangelogApi.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolChangelogApi.kt index 72741c84e..c4168b835 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolChangelogApi.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/PoolChangelogApi.kt @@ -27,7 +27,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest -import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryResponse +import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryVerboseDto import org.springdoc.core.annotations.ParameterObject import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping @@ -56,5 +56,5 @@ interface PoolChangelogApi { fun getChangelogEntries( @RequestBody changelogSearchRequest: ChangelogSearchRequest, @ParameterObject paginationRequest: PaginationRequest - ): PageDto + ): PageDto } \ No newline at end of file diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryResponse.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt similarity index 97% rename from bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryResponse.kt rename to bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt index 519b1a405..e1986226b 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryResponse.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/model/response/ChangelogEntryVerboseDto.kt @@ -25,7 +25,7 @@ import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType import java.time.Instant @Schema(name = "ChangelogEntryVerboseDto", description = "Changelog entry for a business partner") -data class ChangelogEntryResponse( +data class ChangelogEntryVerboseDto( @Schema(description = "Business Partner Number of the changelog entry") val bpn: String, diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt index d2453335e..945b4261c 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogController.kt @@ -23,7 +23,7 @@ import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.pool.api.PoolChangelogApi import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest -import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryResponse +import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryVerboseDto import org.eclipse.tractusx.bpdm.pool.config.ControllerConfigProperties import org.eclipse.tractusx.bpdm.pool.exception.BpdmRequestSizeException import org.eclipse.tractusx.bpdm.pool.service.PartnerChangelogService @@ -40,7 +40,7 @@ class ChangelogController( override fun getChangelogEntries( changelogSearchRequest: ChangelogSearchRequest, paginationRequest: PaginationRequest - ): PageDto { + ): PageDto { changelogSearchRequest.bpns?.let { bpns -> if (bpns.size > controllerConfigProperties.searchRequestLimit) { diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt index 04a6eeb48..833246c06 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/PartnerChangelogService.kt @@ -74,7 +74,7 @@ class PartnerChangelogService( fromTime: Instant?, pageIndex: Int, pageSize: Int - ): PageDto { + ): PageDto { val spec = Specification.allOf(byBpnsIn(bpns), byLsaTypesIn(lsaTypes), byUpdatedGreaterThan(fromTime)) val pageRequest = PageRequest.of(pageIndex, pageSize, Sort.by(PartnerChangelogEntry::updatedAt.name).ascending()) val page = partnerChangelogEntryRepository.findAll(spec, pageRequest) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt index cc44f4adc..bcda0ec55 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/ResponseMappings.kt @@ -273,6 +273,6 @@ fun SyncRecord.toDto(): SyncDto { return SyncDto(type, status, count, progress, errorDetails, startedAt, finishedAt) } -fun PartnerChangelogEntry.toDto(): ChangelogEntryResponse { - return ChangelogEntryResponse(bpn, changelogType, createdAt, changelogSubject) +fun PartnerChangelogEntry.toDto(): ChangelogEntryVerboseDto { + return ChangelogEntryVerboseDto(bpn, changelogType, createdAt, changelogSubject) } diff --git a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt index 4a6412af4..ce24ee86b 100644 --- a/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt +++ b/bpdm-pool/src/test/kotlin/org/eclipse/tractusx/bpdm/pool/controller/ChangelogControllerIT.kt @@ -27,7 +27,7 @@ import org.eclipse.tractusx.bpdm.pool.api.client.PoolClientImpl import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogSubject import org.eclipse.tractusx.bpdm.pool.api.model.ChangelogType import org.eclipse.tractusx.bpdm.pool.api.model.request.ChangelogSearchRequest -import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryResponse +import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryVerboseDto import org.eclipse.tractusx.bpdm.pool.util.* import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -89,14 +89,14 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryResponse(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnL1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnL2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnL1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -148,16 +148,16 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created sites and their main address should be there val expectedChangelogEntries = listOf( - ChangelogEntryResponse(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryResponse(bpnS2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryResponse(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnMainAddress1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnMainAddress2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnS1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryResponse(bpnS2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryResponse(bpnMainAddress1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnMainAddress2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), + ChangelogEntryVerboseDto(bpnS2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), + ChangelogEntryVerboseDto(bpnS2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.SITE), + ChangelogEntryVerboseDto(bpnMainAddress1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -207,14 +207,14 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created addresses including legal and main address val expectedChangelogEntries = listOf( - ChangelogEntryResponse(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), - ChangelogEntryResponse(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnS1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE), + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA1, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnA2, ChangelogType.UPDATE, timeAfterUpdate, ChangelogSubject.ADDRESS) ) @@ -254,12 +254,12 @@ class ChangelogControllerIT @Autowired constructor( val timeAfterUpdate = Instant.now() val expectedEntriesFirstPage = listOf( - ChangelogEntryResponse(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) ) val expectedEntriesSecondPage = listOf( - ChangelogEntryResponse(bpnL3, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL3, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) ) val expectedFirstPage = PageDto(3, 2, 0, expectedEntriesFirstPage.size, expectedEntriesFirstPage) @@ -307,16 +307,16 @@ class ChangelogControllerIT @Autowired constructor( val timeAfterUpdate = Instant.now() val expectedLegalEntityEntries = listOf( - ChangelogEntryResponse(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) ) val expectedSiteEntries = listOf( - ChangelogEntryResponse(bpnS, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE) + ChangelogEntryVerboseDto(bpnS, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.SITE) ) val expectedAddressEntries = listOf( - ChangelogEntryResponse(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), - ChangelogEntryResponse(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS) + ChangelogEntryVerboseDto(bpnLegalAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS), + ChangelogEntryVerboseDto(bpnMainAddress, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.ADDRESS) ) val expectedLegalEntitiesPage = @@ -368,8 +368,8 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryResponse(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterUpdate, ChangelogSubject.LEGAL_ENTITY) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -413,8 +413,8 @@ class ChangelogControllerIT @Autowired constructor( //Log entry for the created legal entities and their legal addresses should be there val expectedChangelogEntries = listOf( - ChangelogEntryResponse(bpnL1, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY), - ChangelogEntryResponse(bpnL2, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY) + ChangelogEntryVerboseDto(bpnL1, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY), + ChangelogEntryVerboseDto(bpnL2, ChangelogType.CREATE, timeAfterSecondInsert, ChangelogSubject.LEGAL_ENTITY) ) val expectedChangelog = PageDto(expectedChangelogEntries.size.toLong(), 1, 0, expectedChangelogEntries.size, expectedChangelogEntries) @@ -429,7 +429,7 @@ class ChangelogControllerIT @Autowired constructor( private fun checkTimestampAscending() = - { changelogEntries: Collection -> + { changelogEntries: Collection -> var lastTimestamp = Instant.MIN for (changelogEntry in changelogEntries) { Assertions.assertThat(changelogEntry.timestamp).isAfterOrEqualTo(lastTimestamp) @@ -438,21 +438,21 @@ class ChangelogControllerIT @Autowired constructor( } private fun checkTimestampsInBetween(after: Instant, before: Instant) = - { changelogEntries: Collection -> + { changelogEntries: Collection -> changelogEntries.forEach { entry -> Assertions.assertThat(entry.timestamp).isBetween(after, before) } } - private fun checkEqual(expected: PageDto) = - { actualResponse: PageDto -> + private fun checkEqual(expected: PageDto) = + { actualResponse: PageDto -> testHelpers.assertRecursively(actualResponse).isEqualTo(expected) Unit } private fun validateChangelogResponse( - actual: PageDto, - expected: PageDto, + actual: PageDto, + expected: PageDto, timeBeforeInsert: Instant, timeAfterInsert: Instant ) { From ac58b4479851d315c9d43af21977ad99c231083a Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:26:16 +0200 Subject: [PATCH 2/2] fix(api): API-Model: Rename DTOs #268 - add PageChangeLogDto --- .../api/model/response/PageChangeLogDto.kt | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogDto.kt diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogDto.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogDto.kt new file mode 100644 index 000000000..8e0b36e77 --- /dev/null +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/model/response/PageChangeLogDto.kt @@ -0,0 +1,43 @@ +/******************************************************************************* + * 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.response + +import io.swagger.v3.oas.annotations.media.Schema +import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError + + +@Schema(description = "Paginated collection of results") +data class PageChangeLogDto( + @Schema(description = "Total number of all results in all pages") + val totalElements: Long, + @Schema(description = "Total number pages") + val totalPages: Int, + @Schema(description = "Current page number") + val page: Int, + @Schema(description = "Number of results in the page") + val contentSize: Int, + @Schema(description = "Collection of results in the page") + val content: Collection, + @Schema(description = "Number of entries in the page that have been omitted due to being invalid (error)") + val invalidEntries: Int, + @Schema(description = "Infos about the entries with errors") + val errors: Collection>, +) +