Skip to content

Commit

Permalink
PIN-3515 Resolved PR issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nttdata-rtorsoli committed Oct 25, 2023
1 parent 599902e commit c7b5e08
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import it.pagopa.interop.authorizationmanagement.model.client.PersistentClientCo
import it.pagopa.interop.authorizationmanagement.model.client.{Api, Consumer}
import it.pagopa.interop.authorizationmanagement.model.key.{Enc, Sig}
import it.pagopa.interop.authorizationmanagement.client.{model => AuthorizationManagementDependency}
import it.pagopa.interop.selfcare.v2.client.{model => SelfcareV2Dependency}
import it.pagopa.interop.authorizationprocess.service.model.UserResource
import it.pagopa.interop.authorizationprocess.common.readmodel.model.ReadModelClientWithKeys
import it.pagopa.interop.authorizationmanagement.model.key.{PersistentKey, PersistentKeyUse}
import it.pagopa.interop.authorizationmanagement.jwk.model.Models._
import it.pagopa.interop.authorizationprocess.error.AuthorizationProcessErrors.{SelfcareEntityNotFilled, MissingUserId}
import it.pagopa.interop.authorizationprocess.error.AuthorizationProcessErrors.MissingUserId
import cats.syntax.all._

import java.util.UUID
Expand Down Expand Up @@ -259,14 +257,4 @@ object Adapters {
implicit class JwkOtherPrimeInfoWrapper(private val o: JwkOtherPrimeInfo) extends AnyVal {
def toApi: OtherPrimeInfo = OtherPrimeInfo(r = o.r, d = o.d, t = o.t)
}

implicit class UserResourceWrapper(private val ur: SelfcareV2Dependency.UserResource) extends AnyVal {
def toApi: Either[Throwable, UserResource] = for {
id <- ur.id.toRight(SelfcareEntityNotFilled(ur.getClass().getName(), "id"))
name <- ur.name.toRight(SelfcareEntityNotFilled(ur.getClass().getName(), "name"))
surname <- ur.surname.toRight(SelfcareEntityNotFilled(ur.getClass().getName(), "surname"))
fiscalCode <- ur.fiscalCode.toRight(SelfcareEntityNotFilled(ur.getClass().getName(), "fiscalCode"))
roles <- ur.roles.toRight(SelfcareEntityNotFilled(ur.getClass().getName(), "roles"))
} yield (UserResource(id = id, name = name, surname = surname, fiscalCode = fiscalCode, roles = roles))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ object AuthorizationProcessErrors {

final case class MissingUserId(kid: String) extends ComponentError("0020", s"Key $kid has not UserId")

final case class SelfcareEntityNotFilled(className: String, field: String)
extends ComponentError("0021", s"Selfcare entity $className with field $field not filled")

final case class InstitutionNotFound(selfcareId: UUID)
extends ComponentError("0022", s"Selfcare institution $selfcareId not found")

Expand Down

This file was deleted.

0 comments on commit c7b5e08

Please sign in to comment.