diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-10-18 13:07:11 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-18 13:07:11 +0700 |
commit | 0c8a7c3f1920e38a0606de91be5793c4f2a1d40a (patch) | |
tree | b1562c4ee366c373f15b07ff6f566a3a94c2eee1 /src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats | |
parent | 2a9bada86658ef15793f99f1867e23f3b31e7032 (diff) | |
parent | 1b1bac0a5cb1f83f3caf9c262fb83916c4a8c222 (diff) | |
download | rest-query-0c8a7c3f1920e38a0606de91be5793c4f2a1d40a.tar.gz rest-query-0c8a7c3f1920e38a0606de91be5793c4f2a1d40a.tar.bz2 rest-query-0c8a7c3f1920e38a0606de91be5793c4f2a1d40a.zip |
Merge pull request #48 from drivergroup/PDSUI-rep-sprayv0.9.1
Fixed spray formats of entities used in Rep
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala | 18 | ||||
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala | 12 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala index 69e8b75..e05e841 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/document.scala @@ -110,7 +110,7 @@ object document { implicit val documentFormat: RootJsonFormat[Document] = new RootJsonFormat[Document] { override def write(document: Document): JsValue = JsObject( - "id" -> document.id.id.toJson, + "id" -> document.id.toJson, "recordId" -> document.recordId.toJson, "physician" -> document.physician.toJson, "typeId" -> document.typeId.toJson, @@ -138,35 +138,35 @@ object document { val physician = fields .get("physician") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val typeId = fields .get("typeId") - .map(_.convertTo[LongId[DocumentType]]) + .flatMap(_.convertTo[Option[LongId[DocumentType]]]) val provider = fields .get("provider") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val providerTypeId = fields .get("providerTypeId") - .map(_.convertTo[LongId[ProviderType]]) + .flatMap(_.convertTo[Option[LongId[ProviderType]]]) val institutionName = fields .get("institutionName") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val meta = fields .get("meta") - .map(_.convertTo[TextJson[Meta]]) + .flatMap(_.convertTo[Option[TextJson[Meta]]]) val startDate = fields .get("startDate") - .map(_.convertTo[LocalDate]) + .flatMap(_.convertTo[Option[LocalDate]]) val endDate = fields .get("endDate") - .map(_.convertTo[LocalDate]) + .flatMap(_.convertTo[Option[LocalDate]]) Document( id = LongId(0), diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala index 66b710e..436fbe9 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/extracteddata.scala @@ -37,15 +37,15 @@ object extracteddata { case JsObject(fields) => val labelId = fields .get("id") - .map(_.convertTo[LongId[Label]]) + .flatMap(_.convertTo[Option[LongId[Label]]]) val categoryId = fields .get("categoryId") - .map(_.convertTo[LongId[LabelCategory]]) + .flatMap(_.convertTo[Option[LongId[LabelCategory]]]) val value = fields .get("value") - .map(_.convertTo[LabelValue]) + .flatMap(_.convertTo[Option[LabelValue]]) ExtractedDataLabel( id = LongId(0), @@ -118,15 +118,15 @@ object extracteddata { val keywordId = fields .get("keywordId") - .map(_.convertTo[LongId[Keyword]]) + .flatMap(_.convertTo[Option[LongId[Keyword]]]) val evidence = fields .get("evidence") - .map(_.convertTo[String]) + .flatMap(_.convertTo[Option[String]]) val meta = fields .get("meta") - .map(_.convertTo[TextJson[Meta]]) + .flatMap(_.convertTo[Option[TextJson[Meta]]]) val labels = fields .get("labels") |