From 9b61a7c031a9f112355f3508ef1760b80f5deff3 Mon Sep 17 00:00:00 2001 From: Stefano Perazzolo <13318704+beetlecrunch@users.noreply.github.com> Date: Thu, 5 Oct 2023 16:06:51 +0200 Subject: [PATCH] Update src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala Co-authored-by: Alessio Gallitano <25105748+galales@users.noreply.github.com> --- .../catalogprocess/api/impl/ProcessApiServiceImpl.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala b/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala index 6de8edbf..3de80f2c 100644 --- a/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala +++ b/src/main/scala/it/pagopa/interop/catalogprocess/api/impl/ProcessApiServiceImpl.scala @@ -406,16 +406,15 @@ final case class ProcessApiServiceImpl( private def deleteRiskAnalysisOnModeUpdate(newMode: EServiceMode, catalogItem: CatalogItem)(implicit contexts: Seq[(String, String)] - ): Future[Unit] = { - val shouldRiskAnalyzesBeDeleted: Boolean = catalogItem.mode == Receive && newMode == EServiceMode.DELIVER - if (shouldRiskAnalyzesBeDeleted) + ): Future[Unit] = + if (newMode == EServiceMode.DELIVER) Future .traverse(catalogItem.riskAnalysis)(risk => catalogManagementService.deleteRiskAnalysis(catalogItem.id, risk.id) ) .map(_ => ()) else Future.unit - } + private def hasNotDraftDescriptor(eService: CatalogItem): Either[Throwable, Boolean] = Either