mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
add query param location id
This commit is contained in:
+12
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user