diff options
author | ktomskikh <ktomskih@datamonsters.co> | 2017-08-03 18:33:35 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-03 18:33:35 +0700 |
commit | 5519c219e2404cb19b6116dee90b40b5e5e2a720 (patch) | |
tree | 67b85ff4f77ec779e1f6cef204d762dcbd4c25c6 /src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue | |
parent | 40ee33a7c176895a19ee0f9066849d34c38c75fd (diff) | |
parent | 91c4944e7cbe8ad254c10d53037011989240c3ae (diff) | |
download | rest-query-5519c219e2404cb19b6116dee90b40b5e5e2a720.tar.gz rest-query-5519c219e2404cb19b6116dee90b40b5e5e2a720.tar.bz2 rest-query-5519c219e2404cb19b6116dee90b40b5e5e2a720.zip |
Merge pull request #16 from drivergroup/PDSUI-2187
PDSUI-2187 Dropped unnecessary fields from issue tables
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue')
2 files changed, 7 insertions, 25 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiDocumentIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiDocumentIssue.scala index fab2546..f157bb2 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiDocumentIssue.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiDocumentIssue.scala @@ -13,9 +13,7 @@ final case class ApiDocumentIssue(id: Long, lastUpdate: ZonedDateTime, userId: String, isDraft: Boolean, - evidence: String, - archiveRequired: Boolean, - meta: String) + archiveRequired: Boolean) object ApiDocumentIssue { implicit val format: Format[ApiDocumentIssue] = ( @@ -26,11 +24,7 @@ object ApiDocumentIssue { (JsPath \ "lastUpdate").format[ZonedDateTime] and (JsPath \ "userId").format[String] and (JsPath \ "isDraft").format[Boolean] and - (JsPath \ "evidence").format[String] and - (JsPath \ "archiveRequired").format[Boolean] and - (JsPath \ "meta").format[String](Format(Reads { x => - JsSuccess(Json.stringify(x)) - }, Writes[String](Json.parse))) + (JsPath \ "archiveRequired").format[Boolean] )(ApiDocumentIssue.apply, unlift(ApiDocumentIssue.unapply)) def fromDomain(x: DocumentIssue) = ApiDocumentIssue( @@ -41,8 +35,6 @@ object ApiDocumentIssue { lastUpdate = ZonedDateTime.of(x.lastUpdate, ZoneId.of("Z")), userId = x.userId.id, isDraft = x.isDraft, - evidence = x.evidence, - archiveRequired = x.archiveRequired, - meta = x.meta + archiveRequired = x.archiveRequired ) } diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiPartialDocumentIssue.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiPartialDocumentIssue.scala index 7a5dbe5..c29b703 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiPartialDocumentIssue.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiPartialDocumentIssue.scala @@ -10,16 +10,12 @@ import xyz.driver.pdsuidomain.entities.{Document, DocumentIssue} final case class ApiPartialDocumentIssue(startPage: Option[Double], endPage: Option[Double], text: String, - evidence: String, - archiveRequired: Boolean, - meta: String) { + archiveRequired: Boolean) { def applyTo(x: DocumentIssue): DocumentIssue = x.copy( startPage = startPage, endPage = endPage, text = text, - evidence = evidence, - archiveRequired = archiveRequired, - meta = meta + archiveRequired = archiveRequired ) def toDomain(userId: StringId[User], documentId: LongId[Document]) = @@ -32,9 +28,7 @@ final case class ApiPartialDocumentIssue(startPage: Option[Double], lastUpdate = LocalDateTime.MIN, isDraft = true, text = text, - evidence = evidence, - archiveRequired = false, - meta = meta + archiveRequired = false ) } @@ -43,10 +37,6 @@ object ApiPartialDocumentIssue { (JsPath \ "startPage").formatNullable[Double] and (JsPath \ "endPage").formatNullable[Double] and (JsPath \ "text").format[String] and - (JsPath \ "evidence").format[String] and - (JsPath \ "archiveRequired").format[Boolean] and - (JsPath \ "meta").format[String](Format(Reads { x => - JsSuccess(Json.stringify(x)) - }, Writes[String](Json.parse))) + (JsPath \ "archiveRequired").format[Boolean] )(ApiPartialDocumentIssue.apply, unlift(ApiPartialDocumentIssue.unapply)) } |