diff options
author | Jakob Odersky <jakob@driver.xyz> | 2017-07-05 19:02:13 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@driver.xyz> | 2017-07-12 21:04:25 -0700 |
commit | f9ac0adf5c3bcfcde03bd3ea2bc2471b0d0f99fe (patch) | |
tree | 9e26568fe6598074a6de8815b465cbfc7ff69b7c /src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala | |
parent | 3d902b5197db861c30325c159dc10cfb211ae209 (diff) | |
download | rest-query-f9ac0adf5c3bcfcde03bd3ea2bc2471b0d0f99fe.tar.gz rest-query-f9ac0adf5c3bcfcde03bd3ea2bc2471b0d0f99fe.tar.bz2 rest-query-f9ac0adf5c3bcfcde03bd3ea2bc2471b0d0f99fe.zip |
Implement REST services for trial curation
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala index 2591509..425eeac 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/message/ApiMessage.scala @@ -4,6 +4,7 @@ import java.time.{ZoneId, ZonedDateTime} import play.api.libs.functional.syntax._ import play.api.libs.json.{Format, JsPath} +import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId} import xyz.driver.pdsuidomain.entities.Message final case class ApiMessage(id: Long, @@ -19,7 +20,26 @@ final case class ApiMessage(id: Long, endPage: Option[Double], evidence: Option[String], archiveRequired: Option[Boolean], - meta: Option[String]) + meta: Option[String]) { + + def toDomain = Message( + id = LongId(this.id), + text = this.text, + lastUpdate = this.lastUpdate.toLocalDateTime(), + userId = StringId(this.userId), + isDraft = this.isDraft, + recordId = this.recordId.map(id => LongId(id)), + documentId = this.documentId.map(id => LongId(id)), + patientId = this.patientId.map(id => UuidId(id)), + trialId = this.trialId.map(id => StringId(id)), + startPage = this.startPage, + endPage = this.endPage, + evidence = this.evidence, + archiveRequired = this.archiveRequired, + meta = this.meta + ) + +} object ApiMessage { |