aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 16:59:16 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-04 16:59:16 +0700
commit6f4de1ccfb6efe8f9ddbaec6551a9138a6efa6f8 (patch)
treeca4259be260ae1fc62aa06e69b6e1c9b4485b054 /src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala
parenta321a978353439fc516b0f2016c28fb32ba1b7ae (diff)
downloadrest-query-6f4de1ccfb6efe8f9ddbaec6551a9138a6efa6f8.tar.gz
rest-query-6f4de1ccfb6efe8f9ddbaec6551a9138a6efa6f8.tar.bz2
rest-query-6f4de1ccfb6efe8f9ddbaec6551a9138a6efa6f8.zip
PDSUI-2268 Added institution field to document
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala
index 1869ff3..3f1ecfe 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala
@@ -2,7 +2,6 @@ package xyz.driver.pdsuidomain.formats.json.document
import java.time.{LocalDate, ZoneId, ZonedDateTime}
import xyz.driver.pdsuicommon.domain.{LongId, StringId, TextJson}
-import xyz.driver.pdsuicommon.json.JsonSerializer
import xyz.driver.pdsuidomain.entities._
import play.api.data.validation.ValidationError
@@ -20,6 +19,7 @@ final case class ApiDocument(id: Long,
provider: Option[String],
providerTypeId: Option[Long],
requiredType: Option[String],
+ institutionName: Option[String],
status: Option[String],
previousStatus: Option[String],
assignee: Option[String],
@@ -46,6 +46,7 @@ final case class ApiDocument(id: Long,
providerName = this.provider,
providerTypeId = this.providerTypeId.map(LongId(_)),
requiredType = this.requiredType.map(extractRequiredType),
+ institutionName = this.institutionName,
meta = this.meta.map(x => TextJson(JsonSerializer.deserialize[Document.Meta](x))),
startDate = this.startDate,
endDate = this.endDate,
@@ -74,6 +75,7 @@ object ApiDocument {
(JsPath \ "provider").formatNullable[String] and
(JsPath \ "providerTypeId").formatNullable[Long] and
(JsPath \ "requiredType").formatNullable[String] and
+ (JsPath \ "institutionName").formatNullable[String] and
(JsPath \ "status").formatNullable(statusFormat) and
(JsPath \ "previousStatus").formatNullable(statusFormat) and
(JsPath \ "assignee").formatNullable[String] and
@@ -96,6 +98,7 @@ object ApiDocument {
provider = document.providerName,
providerTypeId = document.providerTypeId.map(_.id),
requiredType = document.requiredType.map(Document.RequiredType.requiredTypeToString),
+ institutionName = document.institutionName,
status = Option(Document.Status.statusToString(document.status)),
previousStatus = document.previousStatus.map(Document.Status.statusToString),
assignee = document.assignee.map(_.id),