mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'fix/warehouse' into 'development'
[FIX][BE]: add filter location id See merge request mbugroup/lti-api!248
This commit is contained in:
@@ -28,6 +28,7 @@ func (u *WarehouseController) GetAll(c *fiber.Ctx) error {
|
||||
Limit: c.QueryInt("limit", 10),
|
||||
Search: c.Query("search", ""),
|
||||
AreaId: c.QueryInt("area_id", 0),
|
||||
LocationId: c.QueryInt("location_id", 0),
|
||||
ActiveProjectFlockOnly: c.QueryBool("active_project_flock", false),
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,9 @@ func (s warehouseService) GetAll(c *fiber.Ctx, params *validation.Query) ([]enti
|
||||
if params.AreaId != 0 {
|
||||
db = db.Where("area_id = ?", params.AreaId)
|
||||
}
|
||||
if params.LocationId != 0 {
|
||||
db = db.Where("location_id = ?", params.LocationId)
|
||||
}
|
||||
if params.ActiveProjectFlockOnly {
|
||||
db = db.Where(`
|
||||
EXISTS (
|
||||
|
||||
@@ -21,5 +21,6 @@ type Query struct {
|
||||
Limit int `query:"limit" validate:"omitempty,number,min=1,max=100"`
|
||||
Search string `query:"search" validate:"omitempty,max=50"`
|
||||
AreaId int `query:"area_id" validate:"omitempty,number,gt=0"`
|
||||
LocationId int `query:"location_id" validate:"omitempty,number,gt=0"`
|
||||
ActiveProjectFlockOnly bool `query:"active_project_flock"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user