Skip to content

Commit

Permalink
#57 update function isOrderValid
Browse files Browse the repository at this point in the history
  • Loading branch information
setiadijoe committed Jun 23, 2021
1 parent 3aa2b2d commit c8e6438
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions endpoint/request.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package endpoint

import (
"strings"

"github.com/go-ozzo/ozzo-validation/is"
validation "github.com/go-ozzo/ozzo-validation/v4"
"github.com/sapawarga/userpost-service/helper"
Expand Down Expand Up @@ -70,17 +72,6 @@ func validationImages(in []*Image) validation.RuleFunc {
}
}

var ordering = map[int]string{
0: "ASC",
1: "DESC",
}

func isOrderValid(val string) bool {
for i := range ordering {
if ordering[i] == val {
return true
}
}

return false
return strings.EqualFold(val, "ASC") || strings.EqualFold(val, "DESC")
}

0 comments on commit c8e6438

Please sign in to comment.