add query param location id

This commit is contained in:
giovanni
2026-04-13 10:51:12 +07:00
parent 30a47ffc71
commit d1612e5c65
3 changed files with 14 additions and 0 deletions
@@ -178,6 +178,10 @@ func (r *projectFlockKandangRepositoryImpl) GetAllWithFilters(ctx context.Contex
if query.AreaId > 0 {
q = q.Where("\"project_flocks\".\"area_id\" = ?", query.AreaId)
}
if query.LocationId > 0 {
q = q.Where("\"kandangs\".\"location_id\" = ?", query.LocationId)
}
}
if err := q.Model(&entity.ProjectFlockKandang{}).Count(&total).Error; err != nil {
@@ -276,6 +280,10 @@ func (r *projectFlockKandangRepositoryImpl) GetAllWithFiltersScoped(ctx context.
if query.AreaId > 0 {
q = q.Where("\"project_flocks\".\"area_id\" = ?", query.AreaId)
}
if query.LocationId > 0 {
q = q.Where("\"kandangs\".\"location_id\" = ?", query.LocationId)
}
}
if err := q.Model(&entity.ProjectFlockKandang{}).Count(&total).Error; err != nil {
@@ -362,6 +370,10 @@ func (r *projectFlockKandangRepositoryImpl) GetAllNameWithPeriodeScoped(ctx cont
if params.AreaId > 0 {
q = q.Where("\"project_flocks\".\"area_id\" = ?", params.AreaId)
}
if params.LocationId > 0 {
q = q.Where("\"kandangs\".\"location_id\" = ?", params.LocationId)
}
}
if err := q.Count(&total).Error; err != nil {