diff --git a/internal/modules/master/products/services/product.service.go b/internal/modules/master/products/services/product.service.go index 93b62b98..0c49a4ef 100644 --- a/internal/modules/master/products/services/product.service.go +++ b/internal/modules/master/products/services/product.service.go @@ -231,14 +231,14 @@ func (s productService) GetAll(c *fiber.Ctx, params *validation.Query) ([]entity db = s.withRelations(db) includeAll := params.IncludeAll != nil && *params.IncludeAll - // Avoid overlapping behavior: when is_depletion filter is used, keep visible-only catalog. - if params.IsDepletion != nil { - includeAll = false + 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. - // include_all=true can be used to fetch all records (including hidden/system products), - // except when is_depletion is explicitly requested. + // include_all=true can be used to fetch all records (including hidden/system products). + // is_depletion, when provided, is composed as an additional flag filter. if !includeAll { db = db.Where("is_visible = ?", true) }