aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-05 14:56:21 +0700
committerGitHub <noreply@github.com>2017-10-05 14:56:21 +0700
commit1b04669effd79324e52f0dcba0f3714d4a2a957c (patch)
treef790167557d8e3d17224fda4747b4349092a3107 /src/main/scala/xyz/driver/pdsuidomain/services/PatientHypothesisService.scala
parent98dd8b171aee84c88754ea1a8ec20524ad579d7c (diff)
parentc5462a496aeb4d43f023bb427bf12fc87b482b61 (diff)
downloadrest-query-1b04669effd79324e52f0dcba0f3714d4a2a957c.tar.gz
rest-query-1b04669effd79324e52f0dcba0f3714d4a2a957c.tar.bz2
rest-query-1b04669effd79324e52f0dcba0f3714d4a2a957c.zip
Merge pull request #38 from drivergroup/replace-tuplesv0.6.0
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.scala16
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)"
}
}