diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-04 13:16:42 +0700 |
---|---|---|
committer | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-04 13:16:42 +0700 |
commit | bc4f67fe6755a34d410e75ce9b475b3e1c2d38e3 (patch) | |
tree | 6e615a688d90951c6586944f390db1a29ed8841f /src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala | |
parent | a321a978353439fc516b0f2016c28fb32ba1b7ae (diff) | |
download | rest-query-bc4f67fe6755a34d410e75ce9b475b3e1c2d38e3.tar.gz rest-query-bc4f67fe6755a34d410e75ce9b475b3e1c2d38e3.tar.bz2 rest-query-bc4f67fe6755a34d410e75ce9b475b3e1c2d38e3.zip |
Replace tuples in services replies to rich-classes
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala index f782cab..07734ed 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala @@ -23,9 +23,17 @@ object PatientHypothesisService { def userMessage: String = "Access denied" } + final case class RichPatientHypothesis(patientHypothesis: PatientHypothesis, isRequired: Boolean) + + object RichPatientHypothesis { + implicit def toPhiString(x: RichPatientHypothesis): PhiString = { + phi"RichPatientHypothesis(patientHypothesis=${x.patientHypothesis}, isRequired=${x.isRequired})" + } + } + sealed trait GetListReply object GetListReply { - final case class EntityList(xs: Seq[(PatientHypothesis, Boolean)], totalFound: Int) extends GetListReply + final case class EntityList(xs: Seq[RichPatientHypothesis], totalFound: Int) extends GetListReply case object AuthorizationError extends GetListReply with DomainError.AuthorizationError with DefaultAccessDeniedError @@ -38,7 +46,7 @@ object PatientHypothesisService { sealed trait GetByIdReply object GetByIdReply { - final case class Entity(x: PatientHypothesis, isRequired: Boolean) extends GetByIdReply + final case class Entity(x: RichPatientHypothesis) extends GetByIdReply type Error = GetByIdReply with DomainError @@ -53,8 +61,8 @@ object PatientHypothesisService { final case class CommonError(userMessage: String) extends GetByIdReply with DomainError implicit def toPhiString(reply: GetByIdReply): PhiString = reply match { - case x: DomainError => phi"GetByIdReply.Error($x)" - case Entity(x, isRequired) => phi"GetByIdReply.Entity($x, $isRequired)" + case x: DomainError => phi"GetByIdReply.Error($x)" + case Entity(x) => phi"GetByIdReply.Entity($x)" } } |