diff options
author | vlad <vlad@driver.xyz> | 2017-07-20 10:37:08 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-07-20 10:37:08 -0700 |
commit | 5279d01cedb35a759347f194c0e8adb21d19e88e (patch) | |
tree | e340bb2eaba41d917bbca8c5e42b0b76bd164e37 /src/main/scala/xyz/driver/pdsuidomain/formats/json/arm | |
parent | d9c3283c307105e03253c621b9b25a6308ac3b94 (diff) | |
parent | 7f7bd651122754a3df47894b64ddb0456561bbe7 (diff) | |
download | rest-query-5279d01cedb35a759347f194c0e8adb21d19e88e.tar.gz rest-query-5279d01cedb35a759347f194c0e8adb21d19e88e.tar.bz2 rest-query-5279d01cedb35a759347f194c0e8adb21d19e88e.zip |
Merge remote-tracking branch 'origin/master'
# Conflicts:
# build.sbt
# src/main/scala/xyz/driver/pdsuicommon/auth/AuthenticatedRequestContext.scala
# src/main/scala/xyz/driver/pdsuicommon/domain/User.scala
# src/main/scala/xyz/driver/pdsuidomain/formats/json/user/ApiPartialUser.scala
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/arm')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/arm/ApiArm.scala | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/arm/ApiArm.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/arm/ApiArm.scala index 2185e3a..32e2b54 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/arm/ApiArm.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/arm/ApiArm.scala @@ -1,22 +1,35 @@ package xyz.driver.pdsuidomain.formats.json.arm +import xyz.driver.pdsuicommon.domain.{LongId, StringId} import xyz.driver.pdsuidomain.entities.Arm import play.api.libs.functional.syntax._ import play.api.libs.json._ -final case class ApiArm(id: Long, name: String, trialId: String) +final case class ApiArm(id: Long, name: String, originalName: String, trialId: String) { + + def toDomain: Arm = Arm( + id = LongId(this.id), + name = this.name, + originalName = this.originalName, + trialId = StringId(this.trialId), + deleted = None // if we have an ApiArm object, the Arm itself has not been deleted + ) + +} object ApiArm { implicit val format: Format[ApiArm] = ( (JsPath \ "id").format[Long] and (JsPath \ "name").format[String] and + (JsPath \ "originalName").format[String] and (JsPath \ "trialId").format[String] )(ApiArm.apply, unlift(ApiArm.unapply)) def fromDomain(arm: Arm): ApiArm = ApiArm( id = arm.id.id, name = arm.name, + originalName = arm.originalName, trialId = arm.trialId.id ) } |