[FEAT/BE] add product flags in stock

This commit is contained in:
ragilap
2026-02-18 15:30:59 +07:00
parent 62496f78a8
commit e0d42fe6d3
@@ -861,6 +861,7 @@ func (r *RecordingRepositoryImpl) ValidateFeedProductWarehouses(ctx context.Cont
return 0, nil return 0, nil
} }
var invalidIDs []uint var invalidIDs []uint
feedFlags := []string{"PAKAN", "OVK"}
if err := r.DB().WithContext(ctx). if err := r.DB().WithContext(ctx).
Table("product_warehouses pw"). Table("product_warehouses pw").
Where("pw.id IN ?", ids). Where("pw.id IN ?", ids).
@@ -868,8 +869,8 @@ func (r *RecordingRepositoryImpl) ValidateFeedProductWarehouses(ctx context.Cont
SELECT 1 FROM flags f SELECT 1 FROM flags f
WHERE f.flagable_type = 'products' WHERE f.flagable_type = 'products'
AND f.flagable_id = pw.product_id AND f.flagable_id = pw.product_id
AND UPPER(f.name) = 'PAKAN' AND UPPER(f.name) IN ?
)`). )`, feedFlags).
Pluck("pw.id", &invalidIDs).Error; err != nil { Pluck("pw.id", &invalidIDs).Error; err != nil {
return 0, err return 0, err
} }