Skip to content

Commit

Permalink
Update src/main/scala/it/pagopa/interop/catalogprocess/api/impl/Proce…
Browse files Browse the repository at this point in the history
…ssApiServiceImpl.scala

Co-authored-by: Alessio Gallitano <[email protected]>
  • Loading branch information
beetlecrunch and galales authored Oct 5, 2023
1 parent e6d729d commit 9b61a7c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b61a7c

Please sign in to comment.