From ff261c580384915cacbdd1f3a09b214c00866eb1 Mon Sep 17 00:00:00 2001 From: Roberto Taglioni Date: Mon, 15 Jul 2024 12:42:15 +0200 Subject: [PATCH] Add wrappers --- .../service/types/CatalogProcessServiceTypes.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/scala/it/pagopa/interop/backendforfrontend/service/types/CatalogProcessServiceTypes.scala b/src/main/scala/it/pagopa/interop/backendforfrontend/service/types/CatalogProcessServiceTypes.scala index 7d2a6bbb..664931f7 100644 --- a/src/main/scala/it/pagopa/interop/backendforfrontend/service/types/CatalogProcessServiceTypes.scala +++ b/src/main/scala/it/pagopa/interop/backendforfrontend/service/types/CatalogProcessServiceTypes.scala @@ -203,6 +203,9 @@ object CatalogProcessServiceTypes { implicit class AttributeValueWrapper(private val av: CatalogProcess.Attribute) extends AnyVal { def toPersistent: CatalogManagement.CatalogAttribute = CatalogManagement.CatalogAttribute(av.id, av.explicitAttributeVerification) + + def toSeed: CatalogProcess.AttributeSeed = + CatalogProcess.AttributeSeed(av.id, av.explicitAttributeVerification) } implicit class AttributesWrapper(private val eServiceAttributes: CatalogProcess.Attributes) extends AnyVal { @@ -213,6 +216,12 @@ object CatalogProcessServiceTypes { verified = eServiceAttributes.verified.map(_.map(_.toPersistent)) ) + def toSeed: CatalogProcess.AttributesSeed = CatalogProcess.AttributesSeed( + certified = eServiceAttributes.certified.map(_.map(_.toSeed)), + declared = eServiceAttributes.declared.map(_.map(_.toSeed)), + verified = eServiceAttributes.verified.map(_.map(_.toSeed)) + ) + def toApi(attributes: Seq[AttributeProcess.Attribute]): Future[DescriptorAttributes] = { val attributeNames: Map[UUID, AttributeDetails] = attributes.map(attr => attr.id -> AttributeDetails(attr.name, attr.description)).toMap