diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-09-29 13:39:46 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-09-29 13:39:46 +0700 |
commit | d4d7a173ba57e9fc9756b47223ee70fbc03a23b9 (patch) | |
tree | f645e94b71a5ed8e942a5304505b2af7219963e4 /src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala | |
parent | b7dfa70fdc49d0a47f8628139baebf27ad2ea746 (diff) | |
parent | deba20326e3269fee3ef51f8e6841f17453b4155 (diff) | |
download | rest-query-d4d7a173ba57e9fc9756b47223ee70fbc03a23b9.tar.gz rest-query-d4d7a173ba57e9fc9756b47223ee70fbc03a23b9.tar.bz2 rest-query-d4d7a173ba57e9fc9756b47223ee70fbc03a23b9.zip |
Merge branch 'master' of ssh://github.com/drivergroup/pds-ui-common into PDSUI-rep-fixtures
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala deleted file mode 100644 index e383a1f..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialWithLabels.scala +++ /dev/null @@ -1,53 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.export - -import java.time.{Instant, ZoneId} - -import play.api.libs.functional.syntax._ -import play.api.libs.json.{Format, JsPath} -import xyz.driver.pdsuicommon.domain.{StringId, UuidId} -import xyz.driver.pdsuidomain.entities.Trial -import xyz.driver.pdsuidomain.entities.export.trial.ExportTrialWithLabels - -final case class ApiExportTrialWithLabels(nctId: String, - trialId: String, - condition: String, - lastReviewed: Long, - labelVersion: Long, - arms: List[ApiExportTrialArm], - criteria: List[ApiExportTrialLabelCriterion]) { - - def toDomain: ExportTrialWithLabels = { - ExportTrialWithLabels( - StringId[Trial](nctId), - UuidId[Trial](trialId), - condition, - lastReviewed = Instant.ofEpochMilli(lastReviewed).atZone(ZoneId.of("Z")).toLocalDateTime, - labelVersion, - arms.map(_.toDomain), - criteria.map(_.toDomain) - ) - } -} - -object ApiExportTrialWithLabels { - - implicit val format: Format[ApiExportTrialWithLabels] = ( - (JsPath \ "nctId").format[String] and - (JsPath \ "trialId").format[String] and - (JsPath \ "disease").format[String] and - (JsPath \ "lastReviewed").format[Long] and - (JsPath \ "labelVersion").format[Long] and - (JsPath \ "arms").format[List[ApiExportTrialArm]] and - (JsPath \ "criteria").format[List[ApiExportTrialLabelCriterion]] - )(ApiExportTrialWithLabels.apply, unlift(ApiExportTrialWithLabels.unapply)) - - def fromDomain(x: ExportTrialWithLabels) = ApiExportTrialWithLabels( - nctId = x.nctId.id, - trialId = x.trialId.toString, - condition = x.condition, - lastReviewed = x.lastReviewed.atZone(ZoneId.of("Z")).toEpochSecond, - labelVersion = x.labelVersion, - arms = x.arms.map(ApiExportTrialArm.fromDomain), - criteria = x.criteria.map(ApiExportTrialLabelCriterion.fromDomain) - ) -} |