mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
feat: konfigurasi sistem toggle pemakaian pakan ovk negatif
This commit is contained in:
@@ -264,6 +264,18 @@ func (s productService) GetAll(c *fiber.Ctx, params *validation.Query) ([]entity
|
||||
db = db.Where("NOT "+existsQuery, entity.FlagableTypeProduct, depletionProductFlags)
|
||||
}
|
||||
}
|
||||
if strings.TrimSpace(params.Flags) != "" {
|
||||
cleanFlags := utils.ParseFlags(params.Flags)
|
||||
if len(cleanFlags) > 0 {
|
||||
db = db.Where(`
|
||||
EXISTS (
|
||||
SELECT 1 FROM flags f
|
||||
WHERE f.flagable_type = ?
|
||||
AND f.flagable_id = products.id
|
||||
AND UPPER(f.name) IN ?
|
||||
)`, entity.FlagableTypeProduct, cleanFlags)
|
||||
}
|
||||
}
|
||||
return db.Order("created_at DESC").Order("updated_at DESC")
|
||||
})
|
||||
|
||||
|
||||
@@ -46,4 +46,5 @@ type Query struct {
|
||||
ProductCategoryID int `query:"product_category_id" validate:"omitempty,number,min=1"`
|
||||
IsDepletion *bool `query:"is_depletion" validate:"omitempty"`
|
||||
IncludeAll *bool `query:"include_all" validate:"omitempty"`
|
||||
Flags string `query:"flags" validate:"omitempty,max=200"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user