aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 13:16:42 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 13:16:42 +0700
commitbc4f67fe6755a34d410e75ce9b475b3e1c2d38e3 (patch)
tree6e615a688d90951c6586944f390db1a29ed8841f /src/main/scala/xyz/driver/pdsuidomain/services/PatientLabelService.scala
parenta321a978353439fc516b0f2016c28fb32ba1b7ae (diff)
downloadrest-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/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)
}
}
}