Skip to content

Commit

Permalink
PIN-4455 BKE - Add suffix to the name of a fresh new cloned eService (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli authored Feb 5, 2024
1 parent c16586a commit 85b397a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import it.pagopa.interop.commons.utils.TypeConversions.{EitherOps, OptionOps}
import it.pagopa.interop.commons.utils.errors.ComponentError
import it.pagopa.interop.commons.utils.service.{OffsetDateTimeSupplier, UUIDSupplier}

import java.time.format.DateTimeFormatter
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Future}
import akka.Done
Expand Down Expand Up @@ -538,6 +539,7 @@ class EServiceApiServiceImpl(
clonedInterface: Option[CatalogDocument],
clonedDocuments: Seq[CatalogDocument]
): Future[CatalogItem] = {
val now = offsetDateTimeSupplier.get()

for {
version <- VersionGenerator.next(None).toFuture
Expand All @@ -553,7 +555,7 @@ class EServiceApiServiceImpl(
dailyCallsPerConsumer = descriptorToClone.dailyCallsPerConsumer,
dailyCallsTotal = descriptorToClone.dailyCallsTotal,
agreementApprovalPolicy = descriptorToClone.agreementApprovalPolicy,
createdAt = offsetDateTimeSupplier.get(),
createdAt = now,
serverUrls = descriptorToClone.serverUrls,
publishedAt = None,
suspendedAt = None,
Expand All @@ -564,12 +566,12 @@ class EServiceApiServiceImpl(
} yield CatalogItem(
id = uuidSupplier.get(),
producerId = serviceToClone.producerId,
name = s"${serviceToClone.name} - clone",
name = s"${serviceToClone.name} - clone - ${now.format(DateTimeFormatter.ofPattern("dd/MM/yy HH:mm:ss"))}",
description = serviceToClone.description,
technology = serviceToClone.technology,
attributes = None,
descriptors = Seq(descriptor),
createdAt = offsetDateTimeSupplier.get(),
createdAt = now,
riskAnalysis = serviceToClone.riskAnalysis,
mode = serviceToClone.mode
)
Expand Down

0 comments on commit 85b397a

Please sign in to comment.