Skip to content

Commit

Permalink
Merge branch 'PIN-4023' into PIN-3996
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli authored Sep 29, 2023
2 parents 444dfd9 + ef1bd13 commit eddb376
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/interface-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ paths:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/eservices/{eServiceId}/riskanalysis:
/eservices/{eServiceId}/riskAnalysis:
parameters:
- $ref: '#/components/parameters/CorrelationIdHeader'
- $ref: '#/components/parameters/IpAddress'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ final case class ProcessApiServiceImpl(
_ <- assertRequesterAllowed(catalogItem.producerId)(organizationId)
tenant <- tenantManagementService.getTenantById(organizationId)
tenantKind <- tenant.kind.toFuture(TenantKindNotFound(tenant.id))
_ <- isRiskAnalysisFormValid(seed.riskAnalysisForm.toTemplate, true)(tenantKind.toTemplate)
_ <- catalogManagementService.createRiskAnalysis(eServiceUuid, seed.toDependency)
_ <- isRiskAnalysisFormValid(seed.riskAnalysisForm.toTemplate, schemaOnlyValidation = true)(tenantKind.toTemplate)
_ <- catalogManagementService.createRiskAnalysis(eServiceUuid, seed.toDependency)
} yield ()

onComplete(result) {
Expand All @@ -714,8 +714,9 @@ final case class ProcessApiServiceImpl(
_ <- assertRequesterAllowed(catalogItem.producerId)(organizationId)
tenant <- tenantManagementService.getTenantById(organizationId)
tenantKind <- tenant.kind.toFuture(TenantKindNotFound(tenant.id))
_ <- isRiskAnalysisFormValid(seed.riskAnalysisForm.toTemplate, true)(tenantKind.toTemplate)
_ <- catalogManagementService.updateRiskAnalysis(eServiceUuid, riskAnalysisUuid, seed.toDependency)
_ <- isRiskAnalysisFormValid(seed.riskAnalysisForm.toTemplate, schemaOnlyValidation = true)(tenantKind.toTemplate)

_ <- catalogManagementService.updateRiskAnalysis(eServiceUuid, riskAnalysisUuid, seed.toDependency)
} yield ()

onComplete(result) {
Expand Down Expand Up @@ -767,8 +768,8 @@ object ProcessApiServiceImpl {
) Future.unit
else Future.failed(RiskAnalysisNotValid)

def isReceiveEService(eService: CatalogItem)(implicit ec: ExecutionContext): Future[Unit] =
Future.failed(EServiceNotInReceiveMode(eService.id)).unlessA(eService.mode == Receive)
def isReceiveEService(eService: CatalogItem): Future[Unit] =
if (eService.mode == Receive) Future.unit else Future.failed(EServiceNotInReceiveMode(eService.id))

def isDraftEService(eService: CatalogItem): Future[Unit] =
if (eService.descriptors.map(_.state) == Seq(Draft)) Future.unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ object ResponseHandlers extends AkkaResponses {
case Success(s) => success(s)
case Failure(ex: OperationForbidden.type) => forbidden(ex, logMessage)
case Failure(ex: EServiceNotFound) => notFound(ex, logMessage)
case Failure(ex: TenantNotFound) => notFound(ex, logMessage)
case Failure(ex: TenantKindNotFound) => notFound(ex, logMessage)
case Failure(ex: EServiceNotInDraftState) => badRequest(ex, logMessage)
case Failure(ex: EServiceNotInReceiveMode) => badRequest(ex, logMessage)
case Failure(ex: RiskAnalysisNotValid.type) => badRequest(ex, logMessage)
Expand All @@ -71,8 +69,6 @@ object ResponseHandlers extends AkkaResponses {
case Failure(ex: OperationForbidden.type) => forbidden(ex, logMessage)
case Failure(ex: EServiceNotFound) => notFound(ex, logMessage)
case Failure(ex: EServiceRiskAnalysisNotFound) => notFound(ex, logMessage)
case Failure(ex: TenantNotFound) => notFound(ex, logMessage)
case Failure(ex: TenantKindNotFound) => notFound(ex, logMessage)
case Failure(ex: EServiceNotInDraftState) => badRequest(ex, logMessage)
case Failure(ex: EServiceNotInReceiveMode) => badRequest(ex, logMessage)
case Failure(ex: RiskAnalysisNotValid.type) => badRequest(ex, logMessage)
Expand Down

0 comments on commit eddb376

Please sign in to comment.