HOTFIX[BE]: update total price calculation based on product flags for delivery and sales orders

This commit is contained in:
aguhh18
2026-01-22 14:15:03 +07:00
parent 06e92d1c77
commit 87973a6c9f
3 changed files with 106 additions and 10 deletions
@@ -26,7 +26,10 @@ func NewMarketingProductRepository(db *gorm.DB) MarketingProductRepository {
func (r *MarketingProductRepositoryImpl) GetByMarketingID(ctx context.Context, marketingID uint) ([]entity.MarketingProduct, error) {
var products []entity.MarketingProduct
if err := r.DB().WithContext(ctx).Where("marketing_id = ?", marketingID).Find(&products).Error; err != nil {
if err := r.DB().WithContext(ctx).
Preload("ProductWarehouse.Product.Flags").
Where("marketing_id = ?", marketingID).
Find(&products).Error; err != nil {
return nil, err
}
if len(products) == 0 {