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
2 changed files with 117 additions and 127 deletions

View File

@@ -113,10 +113,3 @@ p, BCBSIAD, *, bcbsi, *, *, *, /v1/nemt/eligibility, POST
p, BDCAD, *, techsupport, *, *, *, /v1/nemt/eligibility, POST p, BDCAD, *, techsupport, *, *, *, /v1/nemt/eligibility, POST
p, PLANAD, *, plan, *, *, *, /v1/nemt/eligibility, POST p, PLANAD, *, plan, *, *, *, /v1/nemt/eligibility, POST
p, AD, *, *, *, *, *, /v1/nemt/eligibility, POST p, AD, *, *, *, *, *, /v1/nemt/eligibility, POST
p, VIRPT, *, *, *, *, *, /v1/nemt/users/member, POST
p, VIRPT, *, *, *, *, *, /v1/nemt/users/member, GET
p, VIRPT, *, *, *, *, *, /v1/nemt/eligibility, POST
p, VIRPT, *, *, *, *, *, /v1/nemt/visits, POST
p, VIRPT, *, *, *, *, *, /v1/nemt/rides/eta, GET
p, VIRPT, *, *, *, *, *, /v1/nemt/provider, GET
p, VIRPT, *, *, *, *, *, /v1/selfregister, POST
1 p AD * * * * * * *
113 p BDCAD * techsupport * * * /v1/nemt/eligibility POST
114 p PLANAD * plan * * * /v1/nemt/eligibility POST
115 p AD * * * * * /v1/nemt/eligibility POST
p VIRPT * * * * * /v1/nemt/users/member POST
p VIRPT * * * * * /v1/nemt/users/member GET
p VIRPT * * * * * /v1/nemt/eligibility POST
p VIRPT * * * * * /v1/nemt/visits POST
p VIRPT * * * * * /v1/nemt/rides/eta GET
p VIRPT * * * * * /v1/nemt/provider GET
p VIRPT * * * * * /v1/selfregister POST

View File

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