From 0b90698d1c80ed402290ac88f974da9dbd75cff7 Mon Sep 17 00:00:00 2001 From: Fabrizio Musella Date: Fri, 22 Sep 2023 11:48:38 +0200 Subject: [PATCH] disable update of eservice if purpose in DRAFT --- src/main/resources/interface-specification.yml | 4 ---- .../pagopa/interop/purposemanagement/api/impl/package.scala | 2 +- .../purposemanagement/model/decoupling/PurposeUpdate.scala | 3 --- .../purposemanagement/model/persistence/Adapters.scala | 1 - .../interop/purposemanagement/provider/PurposeSpec.scala | 5 ----- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/resources/interface-specification.yml b/src/main/resources/interface-specification.yml index 05a1185..a1c56df 100644 --- a/src/main/resources/interface-specification.yml +++ b/src/main/resources/interface-specification.yml @@ -694,9 +694,6 @@ components: type: boolean freeOfChargeReason: type: string - eserviceId: - type: string - format: uuid dailyCalls: description: 'maximum number of daily calls that this version can perform.' type: integer @@ -706,7 +703,6 @@ components: - title - description - isFreeOfCharge - - eserviceId - dailyCalls PurposeVersion: type: object diff --git a/src/main/scala/it/pagopa/interop/purposemanagement/api/impl/package.scala b/src/main/scala/it/pagopa/interop/purposemanagement/api/impl/package.scala index 4ea4dda..b05b9eb 100644 --- a/src/main/scala/it/pagopa/interop/purposemanagement/api/impl/package.scala +++ b/src/main/scala/it/pagopa/interop/purposemanagement/api/impl/package.scala @@ -27,7 +27,7 @@ package object impl extends SprayJsonSupport with DefaultJsonProtocol { jsonFormat2(RiskAnalysisMultiAnswerSeed) implicit val riskAnalysisFormSeedFormat: RootJsonFormat[RiskAnalysisFormSeed] = jsonFormat3(RiskAnalysisFormSeed) implicit val purposeSeedFormat: RootJsonFormat[PurposeSeed] = jsonFormat8(PurposeSeed) - implicit val PurposeUpdateContentFormat: RootJsonFormat[PurposeUpdateContent] = jsonFormat7(PurposeUpdateContent) + implicit val PurposeUpdateContentFormat: RootJsonFormat[PurposeUpdateContent] = jsonFormat6(PurposeUpdateContent) implicit val versionDocumentFormat: RootJsonFormat[PurposeVersionDocument] = jsonFormat4(PurposeVersionDocument) implicit val purposeVersionSeedFormat: RootJsonFormat[PurposeVersionSeed] = jsonFormat2(PurposeVersionSeed) implicit val waitingForApprovalPurposeVersionUpdateFormat diff --git a/src/main/scala/it/pagopa/interop/purposemanagement/model/decoupling/PurposeUpdate.scala b/src/main/scala/it/pagopa/interop/purposemanagement/model/decoupling/PurposeUpdate.scala index eb4a6a9..532f187 100644 --- a/src/main/scala/it/pagopa/interop/purposemanagement/model/decoupling/PurposeUpdate.scala +++ b/src/main/scala/it/pagopa/interop/purposemanagement/model/decoupling/PurposeUpdate.scala @@ -6,14 +6,12 @@ import it.pagopa.interop.purposemanagement.model.persistence.Adapters._ import it.pagopa.interop.purposemanagement.model.purpose.PersistentRiskAnalysisForm import java.time.OffsetDateTime -import java.util.UUID final case class DraftPurposeVersionUpdate(dailyCalls: Integer, timestamp: OffsetDateTime) final case class PurposeUpdate( title: String, description: String, - eserviceId: UUID, isFreeOfCharge: Boolean, freeOfChargeReason: Option[String], riskAnalysisForm: Option[PersistentRiskAnalysisForm] @@ -24,7 +22,6 @@ object PurposeUpdate { PurposeUpdate( title = payload.title, description = payload.description, - eserviceId = payload.eserviceId, isFreeOfCharge = payload.isFreeOfCharge, freeOfChargeReason = payload.freeOfChargeReason, riskAnalysisForm = payload.riskAnalysisForm.map(PersistentRiskAnalysisForm.fromSeed(uuidSupplier)) diff --git a/src/main/scala/it/pagopa/interop/purposemanagement/model/persistence/Adapters.scala b/src/main/scala/it/pagopa/interop/purposemanagement/model/persistence/Adapters.scala index 796beb8..7b966ac 100644 --- a/src/main/scala/it/pagopa/interop/purposemanagement/model/persistence/Adapters.scala +++ b/src/main/scala/it/pagopa/interop/purposemanagement/model/persistence/Adapters.scala @@ -179,7 +179,6 @@ object Adapters { p.copy( title = update.title, description = update.description, - eserviceId = update.eserviceId, isFreeOfCharge = update.isFreeOfCharge, freeOfChargeReason = update.freeOfChargeReason, riskAnalysisForm = update.riskAnalysisForm diff --git a/src/test/scala/it/pagopa/interop/purposemanagement/provider/PurposeSpec.scala b/src/test/scala/it/pagopa/interop/purposemanagement/provider/PurposeSpec.scala index 1d817f5..16dec77 100644 --- a/src/test/scala/it/pagopa/interop/purposemanagement/provider/PurposeSpec.scala +++ b/src/test/scala/it/pagopa/interop/purposemanagement/provider/PurposeSpec.scala @@ -548,7 +548,6 @@ class PurposeSpec extends BaseIntegrationSpec { val updateContent = PurposeUpdateContent( title = "Another title", description = "Another description", - eserviceId = eServiceId, isFreeOfCharge = false, freeOfChargeReason = None, riskAnalysisForm = Some(riskAnalysisFormSeed.copy(version = "2.0")), @@ -586,7 +585,6 @@ class PurposeSpec extends BaseIntegrationSpec { val updateContent = PurposeUpdateContent( title = "Another title", description = "Another description", - eserviceId = eServiceId, isFreeOfCharge = false, freeOfChargeReason = None, riskAnalysisForm = Some(riskAnalysisFormSeed.copy(version = "2.0")), @@ -611,7 +609,6 @@ class PurposeSpec extends BaseIntegrationSpec { val updateContent = PurposeUpdateContent( title = "Another title", description = "Another description", - eserviceId = UUID.randomUUID(), isFreeOfCharge = false, freeOfChargeReason = None, riskAnalysisForm = Some(riskAnalysisFormSeed.copy(version = "2.0")), @@ -654,7 +651,6 @@ class PurposeSpec extends BaseIntegrationSpec { val updateContent = PurposeUpdateContent( title = "Another title", description = "Another description", - eserviceId = eServiceId, isFreeOfCharge = false, freeOfChargeReason = None, riskAnalysisForm = Some(riskAnalysisFormSeed.copy(version = "2.0")), @@ -702,7 +698,6 @@ class PurposeSpec extends BaseIntegrationSpec { val updateContent = PurposeUpdateContent( title = "Another title", description = "Another description", - eserviceId = eServiceId, riskAnalysisForm = Some(riskAnalysisFormSeed.copy(version = "2.0")), isFreeOfCharge = false, freeOfChargeReason = None,