Compare commits
2 Commits
7bf95f136f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e83e5a7e3 | |||
| 590fed23ca |
@ -78,16 +78,16 @@ func (r *sqliteCourseRepository) List(
|
||||
direction = "DESC"
|
||||
}
|
||||
|
||||
allowedOrderBy := map[string]bool{
|
||||
"id": true,
|
||||
"name": true,
|
||||
"created_at": true,
|
||||
"updated_at": true,
|
||||
"full_price": true,
|
||||
"discount": true,
|
||||
"duration": true,
|
||||
allowedOrderBy := map[string]struct{}{
|
||||
"id": {},
|
||||
"name": {},
|
||||
"created_at": {},
|
||||
"updated_at": {},
|
||||
"full_price": {},
|
||||
"discount": {},
|
||||
"duration": {},
|
||||
}
|
||||
if !allowedOrderBy[params.OrderBy] {
|
||||
if _, ok := allowedOrderBy[params.OrderBy]; !ok {
|
||||
return result, fmt.Errorf("invalid order by field: %s", params.OrderBy)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user