mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
feat(BE-34): extend DB schema and update master data APIs [partial]
✅ DB Schema: product_warehouse entity and migration ✅ Master Data: added filter params to getall APIs 🚧 Pending: stock_logs implementation and adjustment APIs
This commit is contained in:
@@ -27,6 +27,7 @@ func (u *LocationController) GetAll(c *fiber.Ctx) error {
|
||||
Page: c.QueryInt("page", 1),
|
||||
Limit: c.QueryInt("limit", 10),
|
||||
Search: c.Query("search", ""),
|
||||
AreaId: c.QueryInt("area_id", 0),
|
||||
}
|
||||
|
||||
result, totalResults, err := u.LocationService.GetAll(c, query)
|
||||
|
||||
@@ -54,6 +54,9 @@ func (s locationService) GetAll(c *fiber.Ctx, params *validation.Query) ([]entit
|
||||
if params.Search != "" {
|
||||
db = db.Where("name LIKE ?", "%"+params.Search+"%")
|
||||
}
|
||||
if params.AreaId != 0 {
|
||||
db = db.Where("area_id = ?", params.AreaId)
|
||||
}
|
||||
return db.Order("created_at DESC").Order("updated_at DESC")
|
||||
})
|
||||
|
||||
|
||||
@@ -16,4 +16,5 @@ type Query struct {
|
||||
Page int `query:"page" validate:"omitempty,number,min=1"`
|
||||
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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user