aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.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/PatientLabelService.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/PatientLabelService.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala
index 2a4d7fc..cede890 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala
@@ -24,9 +24,17 @@ object PatientLabelService {
def userMessage: String = "Access denied"
}
+ final case class RichPatientLabel(patientLabel: PatientLabel, isVerified: Boolean)
+
+ object RichPatientLabel {
+ implicit def toPhiString(x: RichPatientLabel): PhiString = {
+ phi"RichPatientLabel(patientLabel=${x.patientLabel}, isVerified=${x.isVerified})"
+ }
+ }
+
sealed trait GetListReply
object GetListReply {
- final case class EntityList(xs: Seq[(PatientLabel, Boolean)], totalFound: Int) extends GetListReply
+ final case class EntityList(xs: Seq[RichPatientLabel], totalFound: Int) extends GetListReply
case object AuthorizationError
extends GetListReply with DomainError.AuthorizationError with DefaultAccessDeniedError
@@ -52,7 +60,7 @@ object PatientLabelService {
sealed trait GetByLabelIdReply
object GetByLabelIdReply {
- final case class Entity(x: PatientLabel, isVerified: Boolean) extends GetByLabelIdReply
+ final case class Entity(x: RichPatientLabel) extends GetByLabelIdReply
type Error = GetByLabelIdReply with DomainError
@@ -68,7 +76,7 @@ object PatientLabelService {
implicit def toPhiString(reply: GetByLabelIdReply): PhiString = reply match {
case x: DomainError => phi"GetByIdReply.Error($x)"
- case Entity(x, y) => phi"GetByIdReply.Entity($x, $y)"
+ case Entity(x) => phi"GetByIdReply.Entity($x)"
}
}
@@ -76,7 +84,7 @@ object PatientLabelService {
object UpdateReply {
type Error = UpdateReply with DomainError
- final case class Updated(updated: PatientLabel, isVerified: Boolean) extends UpdateReply
+ final case class Updated(updated: RichPatientLabel) extends UpdateReply
case object NotFoundError extends UpdateReply with DefaultNotFoundError with DomainError.NotFoundError
@@ -89,8 +97,8 @@ object PatientLabelService {
final case class CommonError(userMessage: String) extends UpdateReply with DomainError
implicit def toPhiString(reply: UpdateReply): PhiString = reply match {
- case Updated(x, y) => phi"Updated($x, $y)"
- case x: Error => DomainError.toPhiString(x)
+ case Updated(x) => phi"Updated($x)"
+ case x: Error => DomainError.toPhiString(x)
}
}
}