aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-11-13 20:45:04 -0800
committervlad <vlad@driver.xyz>2017-11-13 20:45:04 -0800
commiteae48b0256db8efc6417bede691bf7a1e33ab351 (patch)
treef91fc49ca806b7ceafd8e4e3759918a5a0ee3c0d
parentf9057970bcd4c5692ab519a1ee4f0e153999b1c3 (diff)
downloadrest-query-eae48b0256db8efc6417bede691bf7a1e33ab351.tar.gz
rest-query-eae48b0256db8efc6417bede691bf7a1e33ab351.tar.bz2
rest-query-eae48b0256db8efc6417bede691bf7a1e33ab351.zip
Fixing Validatorsv0.14.7
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
index e9085ec..95710be 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/entities/Document.scala
@@ -410,31 +410,31 @@ object Document {
val validator: Validator[Document, Document] = { input =>
for {
- typeId <- Validators.nonEmpty("typeId")(input.typeId)
+ typeId <- Validators.nonEmpty("typeId")(input.typeId).right
- providerTypeId <- Validators.nonEmpty("providerTypeId")(input.providerTypeId)
+ providerTypeId <- Validators.nonEmpty("providerTypeId")(input.providerTypeId).right
- institutionName <- Validators.nonEmpty("institutionName")(input.institutionName)
+ institutionName <- Validators.nonEmpty("institutionName")(input.institutionName).right
- meta <- Validators.nonEmpty("meta")(input.meta)
+ meta <- Validators.nonEmpty("meta")(input.meta).right
- startDate <- Validators.nonEmpty("startDate")(input.startDate)
+ startDate <- Validators.nonEmpty("startDate")(input.startDate).right
- isOrderRight <- input.endDate match {
+ isOrderRight <- (input.endDate match {
case Some(endDate) if startDate.isAfter(endDate) =>
Validators.fail("The start date should be less, than the end one")
case _ => Validators.success(true)
- }
+ }).right
areDatesInThePast <- {
- val dates = List(input.startDate, input.endDate).flatten
- val now = LocalDate.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")
else Validators.success(true)
- }
+ }.right
} yield input
}