aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json
diff options
context:
space:
mode:
authorVlad Uspensky <v.uspenskiy@icloud.com>2017-07-27 09:22:50 -0700
committerGitHub <noreply@github.com>2017-07-27 09:22:50 -0700
commite120d1b2ffbf42b5b809b69a2201b3b8dd1a1ef9 (patch)
tree8d782fdb79c56615dcaf052e7a4bd0cfd7f4d5ef /src/main/scala/xyz/driver/pdsuidomain/formats/json
parent56209581161e4cc2f83f85b52bd573dd25bb7201 (diff)
parent4c7b4102dede53b9707fe3758a4a9ff9ccf87bf8 (diff)
downloadrest-query-e120d1b2ffbf42b5b809b69a2201b3b8dd1a1ef9.tar.gz
rest-query-e120d1b2ffbf42b5b809b69a2201b3b8dd1a1ef9.tar.bz2
rest-query-e120d1b2ffbf42b5b809b69a2201b3b8dd1a1ef9.zip
Merge pull request #10 from drivergroup/PDSUI-2145v0.2.7
PDSUI-2145 Create own user history for Documents and Medical Records
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/documenthistory/ApiDocumentHistory.scala27
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/recordhistory/ApiRecordHistory.scala27
2 files changed, 54 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documenthistory/ApiDocumentHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documenthistory/ApiDocumentHistory.scala
new file mode 100644
index 0000000..5aae774
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documenthistory/ApiDocumentHistory.scala
@@ -0,0 +1,27 @@
+package xyz.driver.pdsuidomain.formats.json.documenthistory
+
+import java.time.{ZoneId, ZonedDateTime}
+
+import play.api.libs.json.{Format, Json}
+import xyz.driver.pdsuidomain.entities.DocumentHistory
+
+final case class ApiDocumentHistory(id: Long,
+ executor: String,
+ documentId: Long,
+ state: String,
+ action: String,
+ created: ZonedDateTime)
+
+object ApiDocumentHistory {
+ implicit val format: Format[ApiDocumentHistory] =
+ Json.format[ApiDocumentHistory]
+
+ def fromDomain(x: DocumentHistory) = ApiDocumentHistory(
+ id = x.id.id,
+ executor = x.executor.id,
+ documentId = x.documentId.id,
+ state = DocumentHistory.State.stateToString(x.state),
+ action = DocumentHistory.Action.actionToString(x.action),
+ created = ZonedDateTime.of(x.created, ZoneId.of("Z"))
+ )
+}
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/recordhistory/ApiRecordHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/recordhistory/ApiRecordHistory.scala
new file mode 100644
index 0000000..c55a78f
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/recordhistory/ApiRecordHistory.scala
@@ -0,0 +1,27 @@
+package xyz.driver.pdsuidomain.formats.json.recordhistory
+
+import java.time.{ZoneId, ZonedDateTime}
+
+import play.api.libs.json.{Format, Json}
+import xyz.driver.pdsuidomain.entities.MedicalRecordHistory
+
+final case class ApiRecordHistory(id: Long,
+ executor: String,
+ recordId: Long,
+ state: String,
+ action: String,
+ created: ZonedDateTime)
+
+object ApiRecordHistory {
+ implicit val format: Format[ApiRecordHistory] =
+ Json.format[ApiRecordHistory]
+
+ def fromDomain(x: MedicalRecordHistory) = ApiRecordHistory(
+ id = x.id.id,
+ executor = x.executor.id,
+ recordId = x.recordId.id,
+ state = MedicalRecordHistory.State.stateToString(x.state),
+ action = MedicalRecordHistory.Action.actionToString(x.action),
+ created = ZonedDateTime.of(x.created, ZoneId.of("Z"))
+ )
+}