Skip to content

Commit

Permalink
Merge pull request #140 from catenax-ng/fix/pool_gate_api_address
Browse files Browse the repository at this point in the history
Fix/pool gate api address
  • Loading branch information
nicoprow authored May 24, 2023
2 parents a8b18a8 + 3949448 commit 57745af
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ package org.eclipse.tractusx.bpdm.common.config
import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.security.OAuthFlow
import io.swagger.v3.oas.models.security.OAuthFlows
import io.swagger.v3.oas.models.security.SecurityRequirement
import io.swagger.v3.oas.models.security.SecurityScheme
import io.swagger.v3.oas.models.security.*
import mu.KotlinLogging
import org.springdoc.core.customizers.OpenApiCustomizer
import org.springdoc.core.models.GroupedOpenApi
Expand Down Expand Up @@ -73,6 +70,7 @@ class OpenApiConfig(
OAuthFlow().authorizationUrl(securityProperties.authUrl)
.tokenUrl(securityProperties.tokenUrl)
.refreshUrl(securityProperties.refreshUrl)
.scopes(Scopes())
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import java.time.Instant

@Schema(name = "LogisticAddressResponse", description = "Logistic address ")
data class LogisticAddressResponse(
@Schema(description = "Business Partner Number of this address")

@get:Schema(description = "Business Partner Number of this address")
val bpn: String,

@Schema(description = "Name of the logistic address of the business partner. This is not according to official\n" +
"registers but according to the name the uploading sharing member chooses.")
@get:Schema(
description = "Name of the logistic address of the business partner. This is not according to official\n" +
"registers but according to the name the uploading sharing member chooses."
)
val name: String? = null,

@ArraySchema(arraySchema = Schema(description = "Address status"))
Expand All @@ -45,21 +48,21 @@ data class LogisticAddressResponse(
@Schema(description = "Alternative postal address")
val alternativePostalAddress: AlternativePostalAddressResponse? = null,

@Schema(description = "BPN of the related legal entity, if available")
@get:Schema(description = "BPN of the related legal entity, if available")
val bpnLegalEntity: String?,

@Schema(description = "Flag if this is the legal address of its related legal entity")
@get:Schema(name = "isLegalAddress", description = "Flag if this is the legal address of its related legal entity")
val isLegalAddress: Boolean = false,

@Schema(description = "BPN of the related site, if available")
@get:Schema(description = "BPN of the related site, if available")
val bpnSite: String?,

@Schema(description = "Flag if this is the main address of its related site")
@get:Schema(name = "isMainAddress", description = "Flag if this is the main address of its related site")
val isMainAddress: Boolean = false,

@Schema(description = "The timestamp the business partner data was created")
@get:Schema(description = "The timestamp the business partner data was created")
val createdAt: Instant,

@Schema(description = "The timestamp the business partner data was last updated")
@get:Schema(description = "The timestamp the business partner data was last updated")
val updatedAt: Instant
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.PageOutputResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.PageStartAfterResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.ValidationResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import org.springframework.web.service.annotation.PutExchange

@RequestMapping("/api/catena")
@RequestMapping("/api/catena", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena")
interface GateAddressApi {

Expand All @@ -60,7 +61,7 @@ interface GateAddressApi {
)
@PutMapping("/input/addresses")
@PutExchange("/input/addresses")
fun upsertAddresses (@RequestBody addresses: Collection<AddressGateInputRequest>): ResponseEntity<Unit>
fun upsertAddresses(@RequestBody addresses: Collection<AddressGateInputRequest>): ResponseEntity<Unit>


@Operation(
Expand Down Expand Up @@ -124,7 +125,7 @@ interface GateAddressApi {
@PostExchange("/output/addresses/search")
fun getAddressesOutput(
@ParameterObject @Valid paginationRequest: PaginationStartAfterRequest,
@RequestBody (required = false) externalIds: Collection<String>?
@RequestBody(required = false) externalIds: Collection<String>?
): PageOutputResponse<AddressGateOutput>

@Operation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.responses.ApiResponses
import org.eclipse.tractusx.bpdm.gate.api.model.BusinessPartnerCandidateDto
import org.eclipse.tractusx.bpdm.gate.api.model.response.TypeMatchResponse
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange

@RequestMapping("/api/catena/business-partners")
@RequestMapping("/api/catena/business-partners", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/business-partners")
interface GateBusinessPartnerApi {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*******************************************************************************
* Copyright (c) 2021,2023 Contributors to the Eclipse Foundation
*
Expand Down Expand Up @@ -33,12 +32,13 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.LsaType
import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import java.time.Instant

@RequestMapping("/api/catena/business-partners/changelog")
@RequestMapping("/api/catena/business-partners/changelog", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/business-partners/changelog")
interface GateChangelogApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.PageOutputResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.PageStartAfterResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.ValidationResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import org.springframework.web.service.annotation.PutExchange

@RequestMapping("/api/catena")
@RequestMapping("/api/catena", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena")
interface GateLegalEntityApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import org.eclipse.tractusx.bpdm.gate.api.model.response.PageOutputResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.PageStartAfterResponse
import org.eclipse.tractusx.bpdm.gate.api.model.response.ValidationResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import org.springframework.web.service.annotation.PutExchange

@RequestMapping("/api/catena")
@RequestMapping("/api/catena", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena")
interface GateSiteApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import org.eclipse.tractusx.bpdm.pool.api.model.request.AddressPartnerSearchRequ
import org.eclipse.tractusx.bpdm.pool.api.model.request.AddressPartnerUpdateRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.*
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import org.springframework.web.service.annotation.PutExchange


@RequestMapping("/api/catena/addresses")
@RequestMapping("/api/catena/addresses", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/addresses")
interface PoolAddressApi {

Expand Down Expand Up @@ -80,6 +81,7 @@ interface PoolAddressApi {
fun getAddress(
@Parameter(description = "Bpn value") @PathVariable bpn: String
): LogisticAddressResponse

@Operation(
summary = "Search address partners by BPNs and/or parent BPNs",
description = "Search business partners of type address by their BPN or their parent partners BPN (BPNLs or BPNS)."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
package org.eclipse.tractusx.bpdm.pool.api



import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.responses.ApiResponses
import org.eclipse.tractusx.bpdm.pool.api.model.request.IdentifiersSearchRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingResponse
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange

@RequestMapping("/api/catena/bpn")
@RequestMapping("/api/catena/bpn", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/bpn")
interface PoolBpnApi {
interface PoolBpnApi {

@Operation(
summary = "Find business partner numbers by identifiers",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.eclipse.tractusx.bpdm.pool.api



import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.media.Content
Expand All @@ -30,16 +29,17 @@ import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest
import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse
import org.eclipse.tractusx.bpdm.pool.api.model.response.ChangelogEntryResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import java.time.Instant

@RequestMapping("/api/catena/business-partners")
@RequestMapping("/api/catena/business-partners", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/business-partners")
interface PoolBusinessPartnerApi {
interface PoolBusinessPartnerApi {

@Operation(
summary = "Get business partner changelog entries by bpn",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ import org.eclipse.tractusx.bpdm.common.dto.response.*
import org.eclipse.tractusx.bpdm.pool.api.model.request.*
import org.eclipse.tractusx.bpdm.pool.api.model.response.*
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange
import org.springframework.web.service.annotation.PutExchange

@RequestMapping("/api/catena/legal-entities")
@RequestMapping("/api/catena/legal-entities", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena/legal-entities")
interface PoolLegalEntityApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ import org.eclipse.tractusx.bpdm.common.dto.response.LegalFormResponse
import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse
import org.eclipse.tractusx.bpdm.pool.api.model.request.LegalFormRequest
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.service.annotation.GetExchange
import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange


@RequestMapping("/api/catena")
@RequestMapping("/api/catena", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/catena")
interface PoolMetadataApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
package org.eclipse.tractusx.bpdm.pool.api



import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.responses.ApiResponses
import org.eclipse.tractusx.bpdm.pool.api.model.response.SyncResponse
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.DeleteMapping
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
Expand All @@ -36,9 +36,9 @@ import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange


@RequestMapping("/api/opensearch")
@RequestMapping("/api/opensearch", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/opensearch")
interface PoolOpenSearchApi {
interface PoolOpenSearchApi {

@Operation(
summary = "Index new business partner records on OpenSearch",
Expand All @@ -54,6 +54,7 @@ interface PoolOpenSearchApi {
@PostMapping("/business-partner")
@PostExchange("/business-partner")
fun export(): SyncResponse

@Operation(
summary = "Fetch information about the latest OpenSearch export",
description = "Fetch information about the latest export (either ongoing or already finished)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
package org.eclipse.tractusx.bpdm.pool.api



import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.responses.ApiResponse
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.PageResponse
import org.eclipse.tractusx.bpdm.pool.api.model.ImportIdEntry
import org.eclipse.tractusx.bpdm.pool.api.model.request.ImportIdFilterRequest
import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest
import org.eclipse.tractusx.bpdm.pool.api.model.response.ImportIdMappingResponse
import org.eclipse.tractusx.bpdm.pool.api.model.response.SyncResponse
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
Expand All @@ -41,9 +41,9 @@ import org.springframework.web.service.annotation.HttpExchange
import org.springframework.web.service.annotation.PostExchange


@RequestMapping("/api/saas")
@RequestMapping("/api/saas", produces = [MediaType.APPLICATION_JSON_VALUE])
@HttpExchange("/api/saas")
interface PoolSaasApi {
interface PoolSaasApi {

@Operation(
summary = "Import new business partner records from SaaS",
Expand All @@ -60,7 +60,7 @@ interface PoolSaasApi {
)
@PostMapping("/business-partner/sync")
@PostExchange("/business-partner/sync")
fun importBusinessPartners() : SyncResponse
fun importBusinessPartners(): SyncResponse

@Operation(
summary = "Fetch information about the SaaS synchronization",
Expand Down
Loading

0 comments on commit 57745af

Please sign in to comment.