mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'fix/is-depletion-hidden' into 'development'
fix: is depletion hidden See merge request mbugroup/lti-api!370
This commit is contained in:
@@ -229,9 +229,17 @@ func (s productService) GetAll(c *fiber.Ctx, params *validation.Query) ([]entity
|
|||||||
|
|
||||||
products, total, err := s.Repository.GetAll(c.Context(), offset, params.Limit, func(db *gorm.DB) *gorm.DB {
|
products, total, err := s.Repository.GetAll(c.Context(), offset, params.Limit, func(db *gorm.DB) *gorm.DB {
|
||||||
db = s.withRelations(db)
|
db = s.withRelations(db)
|
||||||
|
|
||||||
|
includeAll := params.IncludeAll != nil && *params.IncludeAll
|
||||||
|
if params.IsDepletion != nil && *params.IsDepletion {
|
||||||
|
// Auto-expand visibility for depletion catalog so FE doesn't need include_all=true.
|
||||||
|
includeAll = true
|
||||||
|
}
|
||||||
|
|
||||||
// Default: show only visible products.
|
// Default: show only visible products.
|
||||||
// include_all=true can be used to fetch all records (including hidden/system products).
|
// include_all=true can be used to fetch all records (including hidden/system products).
|
||||||
if params.IncludeAll == nil || !*params.IncludeAll {
|
// is_depletion, when provided, is composed as an additional flag filter.
|
||||||
|
if !includeAll {
|
||||||
db = db.Where("is_visible = ?", true)
|
db = db.Where("is_visible = ?", true)
|
||||||
}
|
}
|
||||||
if params.Search != "" {
|
if params.Search != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user