diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-10-20 09:46:28 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-10-20 09:46:28 +0700 |
commit | 6c4ae350eb6444f1d811e2db4f92c96cd331ad74 (patch) | |
tree | 900adc960c55d775cd2fd27be8fe4c462cbbe8b7 /src/main/scala/xyz/driver/pdsuidomain/formats/json/document/ApiDocument.scala | |
parent | 0eb0f1b877237fe20069e66ca460549e5e96377c (diff) | |
parent | 9ca0cae09bc880ce083c2a49ae3804889cc9d4c4 (diff) | |
download | rest-query-6c4ae350eb6444f1d811e2db4f92c96cd331ad74.tar.gz rest-query-6c4ae350eb6444f1d811e2db4f92c96cd331ad74.tar.bz2 rest-query-6c4ae350eb6444f1d811e2db4f92c96cd331ad74.zip |
Merge branch 'master' into TRIAL-55
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.scala | 12 |
1 files changed, 8 insertions, 4 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 3f1ecfe..250e650 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 @@ -25,7 +25,8 @@ final case class ApiDocument(id: Long, assignee: Option[String], previousAssignee: Option[String], lastActiveUser: Option[String], - meta: Option[String]) { + meta: Option[String], + labelVersion: Int) { private def extractStatus(status: String): Document.Status = Document.Status.fromString(status).getOrElse(throw new NoSuchElementException(s"Status $status unknown")) @@ -50,7 +51,8 @@ final case class ApiDocument(id: Long, meta = this.meta.map(x => TextJson(JsonSerializer.deserialize[Document.Meta](x))), startDate = this.startDate, endDate = this.endDate, - lastUpdate = this.lastUpdate.toLocalDateTime() + lastUpdate = this.lastUpdate.toLocalDateTime(), + labelVersion = this.labelVersion ) } @@ -83,7 +85,8 @@ object ApiDocument { (JsPath \ "lastActiveUser").formatNullable[String] and (JsPath \ "meta").formatNullable(Format(Reads { x => JsSuccess(Json.stringify(x)) - }, Writes[String](Json.parse))) + }, Writes[String](Json.parse))) and + (JsPath \ "labelVersion").format[Int] )(ApiDocument.apply, unlift(ApiDocument.unapply)) def fromDomain(document: Document): ApiDocument = { @@ -104,7 +107,8 @@ object ApiDocument { assignee = document.assignee.map(_.id), previousAssignee = document.previousAssignee.map(_.id), lastActiveUser = document.lastActiveUserId.map(_.id), - meta = document.meta.map(meta => JsonSerializer.serialize(meta.content)) + meta = document.meta.map(meta => JsonSerializer.serialize(meta.content)), + labelVersion = document.labelVersion ) } } |