8 Commits

Author SHA1 Message Date
GotPPay
6d77f470ee No need to check on delete 2018-05-28 10:49:13 +02:00
GotPPay
8137447e7f apply regex match on user and locations UUID 2018-05-28 10:49:13 +02:00
GotPPay
1e2b7fcd4c move validation to external function and update rules 2018-05-28 10:49:13 +02:00
GotPPay
1ad4b8a38e update validation rules based on new instructions 2018-05-28 10:49:13 +02:00
GotPPay
f0e63f4166 implement ride validation 2018-05-28 10:49:13 +02:00
Senad Uka
1ed02e2e73 Upsteam sync 2018-05-28 10:49:13 +02:00
GotPPay
cbbbdc601b create structure for rules checking 2018-05-28 10:49:13 +02:00
Senad Uka
d1680d50bf Upstream sync 2018-05-28 10:49:13 +02:00

View File

@@ -1,15 +1,13 @@
package validation
import (
"time"
"fmt"
"strconv"
"regexp"
"strconv"
"time"
"bitbucket.org/nemt/nemt-portal-api/application/viewmodel"
"bitbucket.org/nemt/nemt-portal-api/infra/errors"
)
const (
@@ -38,7 +36,7 @@ func isMixedIDValid(id string) bool {
hasLowerCase := false
hasNumber := false
for _, character := range (id) {
for _, character := range id {
hasUpperCase = hasUpperCase || ((character >= 65) && (character <= 90))
hasLowerCase = hasLowerCase || ((character >= 97) && (character <= 122))
hasNumber = hasNumber || ((character >= 48) && (character <= 57))
@@ -210,6 +208,5 @@ func ValidateRide(requestRide *viewmodel.RideRequest, user *viewmodel.User) []er
result = append(result, errors.ValidationError{Field: "trip_type.key", Message: "Step #4 - Choose a Trip Type"})
}
return result
}