diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-30 16:29:46 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-30 16:29:46 +0700 |
commit | 604fbf0a7a082bc440c0778abd6f90005b210c16 (patch) | |
tree | fd846d42448b2d3f432056898f0c3433475ea0da /src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue | |
parent | 8811d60442d060097027b33784ece9a704458e1d (diff) | |
parent | d92a2795a02b9711aa9aed92a770f85377b31460 (diff) | |
download | rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.gz rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.bz2 rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.zip |
Merge pull request #54 from drivergroup/PDSUI-2336v0.11.0
PDSUI-2336 Cleanup
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue')
2 files changed, 0 insertions, 82 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 deleted file mode 100644 index f157bb2..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiDocumentIssue.scala +++ /dev/null @@ -1,40 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.documentissue - -import java.time.{ZoneId, ZonedDateTime} - -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import xyz.driver.pdsuidomain.entities.DocumentIssue - -final case class ApiDocumentIssue(id: Long, - startPage: Option[Double], - endPage: Option[Double], - text: String, - lastUpdate: ZonedDateTime, - userId: String, - isDraft: Boolean, - archiveRequired: Boolean) - -object ApiDocumentIssue { - implicit val format: Format[ApiDocumentIssue] = ( - (JsPath \ "id").format[Long] and - (JsPath \ "startPage").formatNullable[Double] and - (JsPath \ "endPage").formatNullable[Double] and - (JsPath \ "text").format[String] and - (JsPath \ "lastUpdate").format[ZonedDateTime] and - (JsPath \ "userId").format[String] and - (JsPath \ "isDraft").format[Boolean] and - (JsPath \ "archiveRequired").format[Boolean] - )(ApiDocumentIssue.apply, unlift(ApiDocumentIssue.unapply)) - - def fromDomain(x: DocumentIssue) = ApiDocumentIssue( - id = x.id.id, - startPage = x.startPage, - endPage = x.endPage, - text = x.text, - lastUpdate = ZonedDateTime.of(x.lastUpdate, ZoneId.of("Z")), - userId = x.userId.id, - isDraft = x.isDraft, - 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 deleted file mode 100644 index c29b703..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/documentissue/ApiPartialDocumentIssue.scala +++ /dev/null @@ -1,42 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.documentissue - -import java.time.LocalDateTime - -import play.api.libs.functional.syntax._ -import play.api.libs.json._ -import xyz.driver.pdsuicommon.domain.{LongId, StringId, User} -import xyz.driver.pdsuidomain.entities.{Document, DocumentIssue} - -final case class ApiPartialDocumentIssue(startPage: Option[Double], - endPage: Option[Double], - text: String, - archiveRequired: Boolean) { - def applyTo(x: DocumentIssue): DocumentIssue = x.copy( - startPage = startPage, - endPage = endPage, - text = text, - archiveRequired = archiveRequired - ) - - def toDomain(userId: StringId[User], documentId: LongId[Document]) = - DocumentIssue( - id = LongId(0), - userId = userId, - documentId = documentId, - startPage = startPage, - endPage = endPage, - lastUpdate = LocalDateTime.MIN, - isDraft = true, - text = text, - archiveRequired = false - ) -} - -object ApiPartialDocumentIssue { - implicit val format: Format[ApiPartialDocumentIssue] = ( - (JsPath \ "startPage").formatNullable[Double] and - (JsPath \ "endPage").formatNullable[Double] and - (JsPath \ "text").format[String] and - (JsPath \ "archiveRequired").format[Boolean] - )(ApiPartialDocumentIssue.apply, unlift(ApiPartialDocumentIssue.unapply)) -} |