diff options
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala index 4c006f9..11253fc 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienteligibletrial.scala @@ -8,6 +8,8 @@ import xyz.driver.pdsuidomain.services.PatientEligibleTrialService.RichPatientEl object patienteligibletrial { import DefaultJsonProtocol._ import common._ + import xyz.driver.pdsuidomain.formats.json.trial._ + import xyz.driver.pdsuidomain.formats.json.patientcriterion._ def applyUpdateToTrialArmGroup(json: JsValue, orig: PatientTrialArmGroupView): PatientTrialArmGroupView = json match { @@ -22,19 +24,10 @@ object patienteligibletrial { case _ => deserializationError(s"Expected Json Object as partial PatientTrialArmGroupView, but got $json") } - implicit val patientEligibleTrialWriter: RootJsonWriter[RichPatientEligibleTrial] = - new RootJsonWriter[RichPatientEligibleTrial] { - override def write(obj: RichPatientEligibleTrial) = - JsObject( - "id" -> obj.group.id.toJson, - "patientId" -> obj.group.patientId.toJson, - "trialId" -> obj.group.trialId.toJson, - "trialTitle" -> obj.trial.title.toJson, - "arms" -> obj.arms.map(_.armName).toJson, - "hypothesisId" -> obj.trial.hypothesisId.toJson, - "verifiedEligibilityStatus" -> obj.group.verifiedEligibilityStatus.toJson, - "isVerified" -> obj.group.isVerified.toJson - ) - } + implicit val patientEligibleArmGroupView: RootJsonFormat[PatientTrialArmGroupView] = + jsonFormat7(PatientTrialArmGroupView.apply) + + implicit val patientEligibleTrialFormat: RootJsonFormat[RichPatientEligibleTrial] = + jsonFormat3(RichPatientEligibleTrial.apply) } |