From ea0884b02daa719a6936abe6b15bc80d9a80a71f Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Wed, 6 Sep 2017 14:30:16 -0700 Subject: Add missing formats --- .../formats/json/sprayformats/documentissue.scala | 13 +------------ .../formats/json/sprayformats/providerttype.scala | 12 ++++++++++++ .../pdsuidomain/formats/json/sprayformats/recordissue.scala | 13 +------------ 3 files changed, 14 insertions(+), 24 deletions(-) create mode 100644 src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/providerttype.scala (limited to 'src/main/scala/xyz/driver/pdsuidomain') diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/documentissue.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/documentissue.scala index 28b2a5e..a658cfa 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/documentissue.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/documentissue.scala @@ -61,17 +61,6 @@ object documentissue { case _ => deserializationError(s"Expected Json Object as DocumentIssue, but got $json") } - implicit val documentIssueWriter = new JsonWriter[DocumentIssue] { - override def write(obj: DocumentIssue) = JsObject( - "id" -> obj.id.toJson, - "startPage" -> obj.startPage.toJson, - "endPage" -> obj.endPage.toJson, - "text" -> obj.text.toJson, - "lastUpdate" -> obj.lastUpdate.toJson, - "userId" -> obj.userId.toJson, - "isDraft" -> obj.isDraft.toJson, - "archiveRequired" -> obj.archiveRequired.toJson - ) - } + implicit val documentIssueFormat: RootJsonFormat[DocumentIssue] = jsonFormat9(DocumentIssue.apply) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/providerttype.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/providerttype.scala new file mode 100644 index 0000000..385feb2 --- /dev/null +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/providerttype.scala @@ -0,0 +1,12 @@ +package xyz.driver.pdsuidomain.formats.json.sprayformats + +import spray.json._ +import xyz.driver.pdsuidomain.entities.ProviderType + +object providertype { + import DefaultJsonProtocol._ + import common._ + + implicit val providerTypeFormat: RootJsonFormat[ProviderType] = jsonFormat2(ProviderType.apply) + +} diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/recordissue.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/recordissue.scala index 4ae04d0..4ac5f6d 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/recordissue.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/recordissue.scala @@ -63,17 +63,6 @@ object recordissue { case _ => deserializationError(s"Expected Json Object as MedicalRecordIssue, but got $json") } - implicit val recordIssueWriter = new JsonWriter[MedicalRecordIssue] { - override def write(obj: MedicalRecordIssue) = JsObject( - "id" -> obj.id.toJson, - "startPage" -> obj.startPage.toJson, - "endPage" -> obj.endPage.toJson, - "text" -> obj.text.toJson, - "lastUpdate" -> obj.lastUpdate.toJson, - "userId" -> obj.userId.toJson, - "isDraft" -> obj.isDraft.toJson, - "archiveRequired" -> obj.archiveRequired.toJson - ) - } + implicit val recordIssueFormat = jsonFormat9(MedicalRecordIssue.apply) } -- cgit v1.2.3