Skip to content

Commit

Permalink
Add wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
taglioni-r committed Jul 15, 2024
1 parent 3b95d71 commit ff261c5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit ff261c5

Please sign in to comment.