diff options
author | timgushue <tim@driver.xyz> | 2017-09-25 13:42:52 -0700 |
---|---|---|
committer | timgushue <tim@driver.xyz> | 2017-09-25 13:42:52 -0700 |
commit | 2165af34b96ab25d35e2a3c429da6d7142169fc4 (patch) | |
tree | 48ce9c12c99aa3b32eb081e47f350e3f16a9e55c /src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala | |
parent | f4bd1f867020c9a6b5f3ec3fca11fbaa69e58f22 (diff) | |
download | rest-query-2165af34b96ab25d35e2a3c429da6d7142169fc4.tar.gz rest-query-2165af34b96ab25d35e2a3c429da6d7142169fc4.tar.bz2 rest-query-2165af34b96ab25d35e2a3c429da6d7142169fc4.zip |
fixing imports for slot and eligibility arms
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala new file mode 100644 index 0000000..51821d8 --- /dev/null +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/eligibilityarm/ApiEligibilityArm.scala @@ -0,0 +1,35 @@ +package xyz.driver.pdsuidomain.formats.json.eligibilityarm + +import xyz.driver.pdsuicommon.domain.{LongId, StringId} +import xyz.driver.pdsuidomain.entities.EligibilityArm +import play.api.libs.functional.syntax._ +import play.api.libs.json._ + +final case class ApiEligibilityArm(id: Long, name: String, originalName: String, trialId: String) { + + def toDomain: EligibilityArm = EligibilityArm( + id = LongId(this.id), + name = this.name, + originalName = this.originalName, + trialId = StringId(this.trialId), + deleted = None // if we have an ApiEligibilityArm object, the EligibilityArm itself has not been deleted + ) + +} + +object ApiEligibilityArm { + + implicit val format: Format[ApiEligibilityArm] = ( + (JsPath \ "id").format[Long] and + (JsPath \ "name").format[String] and + (JsPath \ "originalName").format[String] and + (JsPath \ "trialId").format[String] + )(ApiEligibilityArm.apply, unlift(ApiEligibilityArm.unapply)) + + def fromDomain(arm: EligibilityArm): ApiEligibilityArm = ApiEligibilityArm( + id = arm.id.id, + name = arm.name, + originalName = arm.originalName, + trialId = arm.trialId.id + ) +}
\ No newline at end of file |