fix[BE]: validate query page/limit defaults and add exists helpers

This commit is contained in:
aguhh18
2025-10-23 22:00:55 +07:00
parent 1b02b660b9
commit 79b3dd47b8
19 changed files with 105 additions and 1 deletions
+4
View File
@@ -29,6 +29,10 @@ func (u *{{Pascal .Entity}}Controller) GetAll(c *fiber.Ctx) error {
Search: c.Query("search", ""),
}
if query.Page < 1 || query.Limit < 1 {
return fiber.NewError(fiber.StatusBadRequest, "page and limit must be greater than 0")
}
result, totalResults, err := u.{{Pascal .Entity}}Service.GetAll(c, query)
if err != nil {
return err