add filter by kandang id sapronak

This commit is contained in:
MacBook Air M1
2026-01-13 16:14:11 +07:00
parent 0f4cc6e379
commit 7551d11888
4 changed files with 14 additions and 5 deletions
@@ -162,6 +162,14 @@ func (u *ClosingController) GetClosingSapronak(c *fiber.Ctx) error {
Page: c.QueryInt("page", 1),
Limit: c.QueryInt("limit", 10),
}
if raw := c.Query("kandang_id"); raw != "" {
kandangInt, convErr := strconv.Atoi(raw)
if convErr != nil || kandangInt <= 0 {
return fiber.NewError(fiber.StatusBadRequest, "Invalid kandang_id")
}
kandangUint := uint(kandangInt)
query.KandangID = &kandangUint
}
if query.Page < 1 || query.Limit < 1 {
return fiber.NewError(fiber.StatusBadRequest, "page and limit must be greater than 0")
@@ -346,6 +354,7 @@ func (u *ClosingController) GetClosingDataProduksi(c *fiber.Ctx) error {
}
kandangUint := uint(kandangInt)
kandangID = &kandangUint
}
result, err := u.ClosingService.GetClosingDataProduksi(c, uint(id), kandangID)