Fix #16: Repository layer code review: fix critical transaction bug and high-severity issues #17

Merged
hermes merged 2 commits from fix/issue-16 into master 2026-07-20 16:49:36 +00:00
4 changed files with 97 additions and 5 deletions
Showing only changes of commit 590fed23ca - Show all commits

View File

@ -78,16 +78,16 @@ func (r *sqliteCourseRepository) List(
direction = "DESC" direction = "DESC"
} }
allowedOrderBy := map[string]bool{ allowedOrderBy := map[string]struct{}{
"id": true, "id": {},
"name": true, "name": {},
"created_at": true, "created_at": {},
"updated_at": true, "updated_at": {},
"full_price": true, "full_price": {},
"discount": true, "discount": {},
"duration": true, "duration": {},
} }
if !allowedOrderBy[params.OrderBy] { if _, ok := allowedOrderBy[params.OrderBy]; !ok {
return result, fmt.Errorf("invalid order by field: %s", params.OrderBy) return result, fmt.Errorf("invalid order by field: %s", params.OrderBy)
} }