diff options
author | vlad <vlad@driver.xyz> | 2017-07-14 10:38:59 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-07-14 10:38:59 -0700 |
commit | 8353cc012328744c7cdfe0436e23d5e565bea570 (patch) | |
tree | 9ece288a43f30c3bd50393dd28fe17bf54b5e717 /src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala | |
parent | 93eb4829c0d11959709e18a7b489343550633e83 (diff) | |
download | rest-query-8353cc012328744c7cdfe0436e23d5e565bea570.tar.gz rest-query-8353cc012328744c7cdfe0436e23d5e565bea570.tar.bz2 rest-query-8353cc012328744c7cdfe0436e23d5e565bea570.zip |
Clean-up + New User constructor from Driver User
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala b/src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala deleted file mode 100644 index a69283a..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/services/LinkedPatientService.scala +++ /dev/null @@ -1,58 +0,0 @@ -package xyz.driver.pdsuidomain.services - -import xyz.driver.pdsuicommon.domain._ -import xyz.driver.pdsuicommon.error.DomainError -import xyz.driver.pdsuicommon.logging._ -import xyz.driver.pdsuidomain.entities.{LinkedPatient, Patient, Trial} - -import scala.concurrent.Future - -object LinkedPatientService { - - trait DefaultTrialNotFoundError { - def userMessage: String = "Trial not found" - } - - trait DefaultPatientNotFoundError { - def userMessage: String = "Patient not found" - } - - final case class RichLinkedPatient(email: Email, name: String, patientId: UuidId[Patient], trialId: StringId[Trial]) { - def toLinkedPatient(user: User) = LinkedPatient( - userId = user.id, - patientId = patientId, - trialId = trialId - ) - } - - object RichLinkedPatient { - implicit def toPhiString(x: RichLinkedPatient): PhiString = { - import x._ - phi"RichLinkedPatient(email=${Unsafe(email)}, patientId=$patientId, trialId=$trialId)" - } - } - - sealed trait CreateReply - object CreateReply { - type Error = CreateReply with DomainError - - /** - * @param createdUser None if a user was created before - */ - final case class Created(x: RichLinkedPatient, createdUser: Option[User]) extends CreateReply - - case object PatientNotFoundError - extends CreateReply with DefaultPatientNotFoundError with DomainError.NotFoundError - - case object TrialNotFoundError extends CreateReply with DefaultPatientNotFoundError with DomainError.NotFoundError - - final case class CommonError(userMessage: String) extends CreateReply with DomainError - } -} - -trait LinkedPatientService { - - import LinkedPatientService._ - - def create(entity: RichLinkedPatient): Future[CreateReply] -} |