diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-09-26 12:48:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-26 12:48:55 -0700 |
commit | 7bb4873042d1bc557a7f2e78b15a44d3ba182bf5 (patch) | |
tree | 15fe180be3f035f308168d5564d01cf293a1f83a /src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala | |
parent | 2cd8e672feba0d076f4f44f556f993f1db2043b7 (diff) | |
parent | c0ffb2a34240876c16f9ce62205cf257aa6d5991 (diff) | |
download | rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.tar.gz rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.tar.bz2 rest-query-7bb4873042d1bc557a7f2e78b15a44d3ba182bf5.zip |
Merge pull request #29 from drivergroup/PDSUI-2275
PDSUI-2275 Added delivery_method field to intervention table
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala index 74f16e1..28a8555 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/intervention/ApiPartialIntervention.scala @@ -16,6 +16,7 @@ final case class ApiPartialIntervention(name: Option[String], typeId: Option[Long], dosage: Option[String], isActive: Option[Boolean], + deliveryMethod: Option[String], arms: Option[List[Long]]) { def applyTo(orig: InterventionWithArms): InterventionWithArms = { @@ -26,7 +27,8 @@ final case class ApiPartialIntervention(name: Option[String], name = name.getOrElse(origIntervention.name), typeId = typeId.map(LongId(_)).orElse(origIntervention.typeId), dosage = dosage.getOrElse(origIntervention.dosage), - isActive = isActive.getOrElse(origIntervention.isActive) + isActive = isActive.getOrElse(origIntervention.isActive), + deliveryMethod = deliveryMethod.orElse(origIntervention.deliveryMethod) ), arms = draftArmList.getOrElse(orig.arms) ) @@ -50,7 +52,8 @@ final case class ApiPartialIntervention(name: Option[String], originalType = Option(""), dosage = dosage.getOrElse(""), originalDosage = dosage.getOrElse(""), - isActive = isActive.getOrElse(false) + isActive = isActive.getOrElse(false), + deliveryMethod = deliveryMethod ), arms = arms.map(_.map(x => InterventionArm(armId = LongId(x), interventionId = LongId(0)))).getOrElse(List.empty) @@ -69,6 +72,7 @@ object ApiPartialIntervention { (JsPath \ "typeId").readNullable[Long] and (JsPath \ "dosage").readNullable[String] and (JsPath \ "isActive").readNullable[Boolean] and + (JsPath \ "deliveryMethod").readNullable[String] and (JsPath \ "arms").readNullable[List[Long]] )(ApiPartialIntervention.apply _) @@ -78,6 +82,7 @@ object ApiPartialIntervention { (JsPath \ "typeId").writeNullable[Long] and (JsPath \ "dosage").writeNullable[String] and (JsPath \ "isActive").writeNullable[Boolean] and + (JsPath \ "deliveryMethod").writeNullable[String] and (JsPath \ "arms").writeNullable[List[Long]] )(unlift(ApiPartialIntervention.unapply)) |