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"
}
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)
}