Skip to content

Commit

Permalink
order type
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Oct 22, 2023
1 parent 1382812 commit 8818907
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const (
Descending OrderDirectionType = "desc"
)

var orderColumns = map[string]bool{
string(LastLogin): true,
string(Name): true,
var orderColumns = map[OrderColumnType]bool{
LastLogin: true,
Name: true,
}

var orderDirections = map[string]bool{
string(Ascending): true,
string(Descending): true,
var orderDirections = map[OrderDirectionType]bool{
Ascending: true,
Descending: true,
}

type AuthSearch struct {
Expand Down Expand Up @@ -81,9 +81,9 @@ func (repo *AuthRepository) buildWhereClause(fields string, s *AuthSearch) (stri
i++
}

if s.OrderColumn != nil && orderColumns[string(*s.OrderColumn)] {
if s.OrderColumn != nil && orderColumns[*s.OrderColumn] {
order := Ascending
if s.OrderDirection != nil && orderDirections[string(*s.OrderDirection)] {
if s.OrderDirection != nil && orderDirections[*s.OrderDirection] {
order = *s.OrderDirection
}

Expand Down

0 comments on commit 8818907

Please sign in to comment.