From d180eda5c14cf1a942c6a1a5b3ca35678fbe3ff2 Mon Sep 17 00:00:00 2001 From: ElisKina-dev Date: Tue, 17 Dec 2024 12:04:42 +0100 Subject: [PATCH 1/2] esposizione API getOrganizationBroker --- openapi/generated.openapi.json | 276 ++++++++++-------- .../repository/BrokerRepository.java | 7 + 2 files changed, 161 insertions(+), 122 deletions(-) diff --git a/openapi/generated.openapi.json b/openapi/generated.openapi.json index e855203..2100b91 100644 --- a/openapi/generated.openapi.json +++ b/openapi/generated.openapi.json @@ -108,6 +108,38 @@ } } }, + "/brokers/search/findByOrgFiscalCode": { + "get": { + "tags": [ + "broker-search-controller" + ], + "operationId": "executeSearch-broker-get", + "parameters": [ + { + "name": "orgFiscalCode", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/hal+json": { + "schema": { + "$ref": "#/components/schemas/EntityModelBroker" + } + } + } + }, + "404": { + "description": "Not Found" + } + } + } + }, "/brokers/{id}": { "get": { "tags": [ @@ -705,6 +737,128 @@ } } }, + "PersonalisationFe": { + "type": "object", + "properties": { + "headerAssistanceUrl": { + "type": "string" + }, + "logoFooterImg": { + "type": "string" + }, + "footerDescText": { + "type": "string" + }, + "footerPrivacyInfoUrl": { + "type": "string" + }, + "footerGDPRUrl": { + "type": "string" + }, + "footerTermsCondUrl": { + "type": "string" + }, + "footerAccessibilityUrl": { + "type": "string" + } + } + }, + "EntityModelBroker": { + "type": "object", + "properties": { + "brokerId": { + "type": "integer", + "format": "int64" + }, + "organizationId": { + "type": "integer", + "format": "int64" + }, + "brokerFiscalCode": { + "type": "string" + }, + "brokerName": { + "type": "string" + }, + "pagoPaInteractionModel": { + "type": "string", + "enum": [ + "SYNC", + "SYNC_ACA", + "SYNC$GPDPRELOAD", + "SYNC_ACA$GPDPRELOAD", + "ASYNC_GPD" + ] + }, + "stationId": { + "type": "string" + }, + "broadcastStationId": { + "type": "string" + }, + "syncKey": { + "type": "string", + "format": "byte" + }, + "gpdKey": { + "type": "string", + "format": "byte" + }, + "acaKey": { + "type": "string", + "format": "byte" + }, + "personalisationFe": { + "$ref": "#/components/schemas/PersonalisationFe" + }, + "_links": { + "$ref": "#/components/schemas/Links" + } + } + }, + "PageMetadata": { + "type": "object", + "properties": { + "size": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + } + } + }, + "PagedModelEntityModelBroker": { + "type": "object", + "properties": { + "_embedded": { + "type": "object", + "properties": { + "broker": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityModelBroker" + } + } + } + }, + "_links": { + "$ref": "#/components/schemas/Links" + }, + "page": { + "$ref": "#/components/schemas/PageMetadata" + } + } + }, "EntityModelOrganization": { "type": "object", "properties": { @@ -818,27 +972,6 @@ } } }, - "PageMetadata": { - "type": "object", - "properties": { - "size": { - "type": "integer", - "format": "int64" - }, - "totalElements": { - "type": "integer", - "format": "int64" - }, - "totalPages": { - "type": "integer", - "format": "int64" - }, - "number": { - "type": "integer", - "format": "int64" - } - } - }, "PagedModelEntityModelOrganization": { "type": "object", "properties": { @@ -861,107 +994,6 @@ } } }, - "PersonalisationFe": { - "type": "object", - "properties": { - "headerAssistanceUrl": { - "type": "string" - }, - "logoFooterImg": { - "type": "string" - }, - "footerDescText": { - "type": "string" - }, - "footerPrivacyInfoUrl": { - "type": "string" - }, - "footerGDPRUrl": { - "type": "string" - }, - "footerTermsCondUrl": { - "type": "string" - }, - "footerAccessibilityUrl": { - "type": "string" - } - } - }, - "EntityModelBroker": { - "type": "object", - "properties": { - "brokerId": { - "type": "integer", - "format": "int64" - }, - "organizationId": { - "type": "integer", - "format": "int64" - }, - "brokerFiscalCode": { - "type": "string" - }, - "brokerName": { - "type": "string" - }, - "pagoPaInteractionModel": { - "type": "string", - "enum": [ - "SYNC", - "SYNC_ACA", - "SYNC$GPDPRELOAD", - "SYNC_ACA$GPDPRELOAD", - "ASYNC_GPD" - ] - }, - "stationId": { - "type": "string" - }, - "broadcastStationId": { - "type": "string" - }, - "syncKey": { - "type": "string", - "format": "byte" - }, - "gpdKey": { - "type": "string", - "format": "byte" - }, - "acaKey": { - "type": "string", - "format": "byte" - }, - "personalisationFe": { - "$ref": "#/components/schemas/PersonalisationFe" - }, - "_links": { - "$ref": "#/components/schemas/Links" - } - } - }, - "PagedModelEntityModelBroker": { - "type": "object", - "properties": { - "_embedded": { - "type": "object", - "properties": { - "broker": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EntityModelBroker" - } - } - } - }, - "_links": { - "$ref": "#/components/schemas/Links" - }, - "page": { - "$ref": "#/components/schemas/PageMetadata" - } - } - }, "BrokerRequestBody": { "type": "object", "properties": { diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java index ecf11d2..f7d3641 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java @@ -2,9 +2,16 @@ import it.gov.pagopa.pu.organization.model.Broker; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.rest.core.annotation.RepositoryRestResource; +import java.util.Optional; + @RepositoryRestResource(collectionResourceRel = "broker", path = "brokers") public interface BrokerRepository extends JpaRepository { + @Query("select b from broker b join Organization o on b.organizationId = o.organizationId " + + "where o.orgFiscalCode = :orgFiscalCode") + Optional findByOrgFiscalCode(String orgFiscalCode); + } From 875f9e5041494c527ba62242e95e201b0267aee3 Mon Sep 17 00:00:00 2001 From: ElisKina-dev Date: Tue, 17 Dec 2024 17:23:14 +0100 Subject: [PATCH 2/2] fix query --- openapi/generated.openapi.json | 244 +++++++++--------- .../repository/BrokerRepository.java | 2 +- 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/openapi/generated.openapi.json b/openapi/generated.openapi.json index 2100b91..45dbd55 100644 --- a/openapi/generated.openapi.json +++ b/openapi/generated.openapi.json @@ -737,128 +737,6 @@ } } }, - "PersonalisationFe": { - "type": "object", - "properties": { - "headerAssistanceUrl": { - "type": "string" - }, - "logoFooterImg": { - "type": "string" - }, - "footerDescText": { - "type": "string" - }, - "footerPrivacyInfoUrl": { - "type": "string" - }, - "footerGDPRUrl": { - "type": "string" - }, - "footerTermsCondUrl": { - "type": "string" - }, - "footerAccessibilityUrl": { - "type": "string" - } - } - }, - "EntityModelBroker": { - "type": "object", - "properties": { - "brokerId": { - "type": "integer", - "format": "int64" - }, - "organizationId": { - "type": "integer", - "format": "int64" - }, - "brokerFiscalCode": { - "type": "string" - }, - "brokerName": { - "type": "string" - }, - "pagoPaInteractionModel": { - "type": "string", - "enum": [ - "SYNC", - "SYNC_ACA", - "SYNC$GPDPRELOAD", - "SYNC_ACA$GPDPRELOAD", - "ASYNC_GPD" - ] - }, - "stationId": { - "type": "string" - }, - "broadcastStationId": { - "type": "string" - }, - "syncKey": { - "type": "string", - "format": "byte" - }, - "gpdKey": { - "type": "string", - "format": "byte" - }, - "acaKey": { - "type": "string", - "format": "byte" - }, - "personalisationFe": { - "$ref": "#/components/schemas/PersonalisationFe" - }, - "_links": { - "$ref": "#/components/schemas/Links" - } - } - }, - "PageMetadata": { - "type": "object", - "properties": { - "size": { - "type": "integer", - "format": "int64" - }, - "totalElements": { - "type": "integer", - "format": "int64" - }, - "totalPages": { - "type": "integer", - "format": "int64" - }, - "number": { - "type": "integer", - "format": "int64" - } - } - }, - "PagedModelEntityModelBroker": { - "type": "object", - "properties": { - "_embedded": { - "type": "object", - "properties": { - "broker": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EntityModelBroker" - } - } - } - }, - "_links": { - "$ref": "#/components/schemas/Links" - }, - "page": { - "$ref": "#/components/schemas/PageMetadata" - } - } - }, "EntityModelOrganization": { "type": "object", "properties": { @@ -972,6 +850,27 @@ } } }, + "PageMetadata": { + "type": "object", + "properties": { + "size": { + "type": "integer", + "format": "int64" + }, + "totalElements": { + "type": "integer", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "format": "int64" + }, + "number": { + "type": "integer", + "format": "int64" + } + } + }, "PagedModelEntityModelOrganization": { "type": "object", "properties": { @@ -994,6 +893,107 @@ } } }, + "EntityModelBroker": { + "type": "object", + "properties": { + "brokerId": { + "type": "integer", + "format": "int64" + }, + "organizationId": { + "type": "integer", + "format": "int64" + }, + "brokerFiscalCode": { + "type": "string" + }, + "brokerName": { + "type": "string" + }, + "pagoPaInteractionModel": { + "type": "string", + "enum": [ + "SYNC", + "SYNC_ACA", + "SYNC$GPDPRELOAD", + "SYNC_ACA$GPDPRELOAD", + "ASYNC_GPD" + ] + }, + "stationId": { + "type": "string" + }, + "broadcastStationId": { + "type": "string" + }, + "syncKey": { + "type": "string", + "format": "byte" + }, + "gpdKey": { + "type": "string", + "format": "byte" + }, + "acaKey": { + "type": "string", + "format": "byte" + }, + "personalisationFe": { + "$ref": "#/components/schemas/PersonalisationFe" + }, + "_links": { + "$ref": "#/components/schemas/Links" + } + } + }, + "PersonalisationFe": { + "type": "object", + "properties": { + "headerAssistanceUrl": { + "type": "string" + }, + "logoFooterImg": { + "type": "string" + }, + "footerDescText": { + "type": "string" + }, + "footerPrivacyInfoUrl": { + "type": "string" + }, + "footerGDPRUrl": { + "type": "string" + }, + "footerTermsCondUrl": { + "type": "string" + }, + "footerAccessibilityUrl": { + "type": "string" + } + } + }, + "PagedModelEntityModelBroker": { + "type": "object", + "properties": { + "_embedded": { + "type": "object", + "properties": { + "broker": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityModelBroker" + } + } + } + }, + "_links": { + "$ref": "#/components/schemas/Links" + }, + "page": { + "$ref": "#/components/schemas/PageMetadata" + } + } + }, "BrokerRequestBody": { "type": "object", "properties": { diff --git a/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java b/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java index f7d3641..6b7ab60 100644 --- a/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java +++ b/src/main/java/it/gov/pagopa/pu/organization/repository/BrokerRepository.java @@ -10,7 +10,7 @@ @RepositoryRestResource(collectionResourceRel = "broker", path = "brokers") public interface BrokerRepository extends JpaRepository { - @Query("select b from broker b join Organization o on b.organizationId = o.organizationId " + + @Query("select b from broker b join Organization o on b.brokerId = o.brokerId " + "where o.orgFiscalCode = :orgFiscalCode") Optional findByOrgFiscalCode(String orgFiscalCode);