aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-06-14 14:46:19 -0700
committervlad <vlad@driver.xyz>2017-06-14 14:46:19 -0700
commit7b8ac40ab6501ec53c5a55962fe4a3d54666ae8d (patch)
tree211a6a544facb278807d47cc3d91f0cee59f2466 /src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
parent59aababea4a8856ac972fe452b14003f82fe3706 (diff)
downloadrest-query-7b8ac40ab6501ec53c5a55962fe4a3d54666ae8d.tar.gz
rest-query-7b8ac40ab6501ec53c5a55962fe4a3d54666ae8d.tar.bz2
rest-query-7b8ac40ab6501ec53c5a55962fe4a3d54666ae8d.zip
Update for recent PDS UI changesv0.1.4
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
index b10f67a..9fc1992 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
@@ -1,6 +1,6 @@
package xyz.driver.pdsuidomain.entities
-import java.time.LocalDateTime
+import java.time.{LocalDate, LocalDateTime}
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.core.{JsonGenerator, JsonParser}
@@ -101,15 +101,15 @@ object Document {
startDate <- Validators.nonEmpty("startDate")(input.startDate)
isOrderRight <- input.endDate match {
- case Some(endDate) if startDate.isAfter(endDate) =>
- Validators.fail("The start date should be less, than the end one")
+ case Some(endDate) if startDate.isAfter(endDate) =>
+ Validators.fail("The start date should be less, than the end one")
- case _ => Validators.success(true)
- }
+ case _ => Validators.success(true)
+ }
areDatesInThePast <- {
- val dates = List(input.startDate, input.endDate).flatten
- val now = LocalDateTime.now()
+ val dates = List(input.startDate, input.endDate).flatten
+ val now = LocalDate.now()
val hasInvalid = dates.exists(_.isAfter(now))
if (hasInvalid) Validators.fail("Dates should be in the past")
@@ -129,17 +129,18 @@ case class Document(id: LongId[Document] = LongId(0L),
recordId: LongId[MedicalRecord],
physician: Option[String],
typeId: Option[LongId[DocumentType]], // not null
- providerName: Option[String], // not null
+ providerName: Option[String], // not null
providerTypeId: Option[LongId[ProviderType]], // not null
meta: Option[TextJson[Meta]], // not null
- startDate: Option[LocalDateTime], // not null
- endDate: Option[LocalDateTime],
+ startDate: Option[LocalDate], // not null
+ endDate: Option[LocalDate],
lastUpdate: LocalDateTime) {
import Document.Status._
if (previousStatus.nonEmpty) {
- assert(AllPrevious.contains(previousStatus.get), s"Previous status has invalid value: ${previousStatus.get}")
+ assert(AllPrevious.contains(previousStatus.get),
+ s"Previous status has invalid value: ${previousStatus.get}")
}
// TODO: with the current business logic code this constraint sometimes harmful