add sorting at marketing

This commit is contained in:
giovanni
2026-05-07 14:03:17 +07:00
parent 81b9e88bb6
commit 0357531e73
3 changed files with 29 additions and 1 deletions
@@ -56,6 +56,12 @@ func (u *DeliveryOrdersController) GetAll(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusBadRequest, "Invalid product_ids")
}
sortBy := strings.TrimSpace(c.Query("sort_by", ""))
sortOrder := strings.TrimSpace(c.Query("sort_order", ""))
if sortOrder == "" {
sortOrder = "asc"
}
query := &validation.DeliveryOrderQuery{
Page: c.QueryInt("page", 1),
Limit: c.QueryInt("limit", 10),
@@ -66,6 +72,8 @@ func (u *DeliveryOrdersController) GetAll(c *fiber.Ctx) error {
MarketingId: uint(c.QueryInt("marketing_id", 0)),
ProjectFlockID: uint(c.QueryInt("project_flock_id", 0)),
ProjectFlockKandangID: uint(c.QueryInt("project_flock_kandang_id", 0)),
SortBy: sortBy,
SortOrder: sortOrder,
}
if isAllExcelExportRequest(c) {