diff --git a/internal/kurious/adapters/sqlite_course_repository.go b/internal/kurious/adapters/sqlite_course_repository.go index 703d352..e7dd700 100644 --- a/internal/kurious/adapters/sqlite_course_repository.go +++ b/internal/kurious/adapters/sqlite_course_repository.go @@ -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) }