Feat[BE-127] Creating project flock kandang get all with soma query param

This commit is contained in:
aguhh18
2025-11-06 17:57:10 +07:00
parent d587a793fe
commit 663d5129bb
4 changed files with 126 additions and 66 deletions
@@ -24,9 +24,16 @@ func NewProjectFlockKandangController(projectFlockKandangService service.Project
func (u *ProjectFlockKandangController) GetAll(c *fiber.Ctx) error {
query := &validation.Query{
Page: c.QueryInt("page", 1),
Limit: c.QueryInt("limit", 10),
Search: c.Query("search", ""),
Page: c.QueryInt("page", 1),
Limit: c.QueryInt("limit", 10),
Search: c.Query("search", ""),
ProjectFlockId: uint(c.QueryInt("project_flock_id", 0)),
KandangId: uint(c.QueryInt("kandang_id", 0)),
Category: c.Query("category", ""),
AreaId: uint(c.QueryInt("area_id", 0)),
SortBy: c.Query("sort_by", ""),
SortOrder: c.Query("sort_order", ""),
StepName: c.Query("step_name", ""),
}
if query.Page < 1 || query.Limit < 1 {
@@ -38,7 +45,7 @@ func (u *ProjectFlockKandangController) GetAll(c *fiber.Ctx) error {
return err
}
var data []dto.ProjectFlockKandangListDTO
data := make([]dto.ProjectFlockKandangListDTO, 0)
for _, result := range results {
data = append(data, dto.ToProjectFlockKandangListDTO(result.Entity))
}