cmd: check validate and fix bug risks in commands

This commit is contained in:
Adnan Zahir
2026-04-24 01:48:30 +07:00
parent 20479c2ca2
commit 9a19bff8d3
8 changed files with 52 additions and 29 deletions
@@ -729,6 +729,9 @@ func reflowAndRecalculateProductWarehouse(
if err != nil {
return fmt.Errorf("resolve flag group for product_warehouse %d: %w", productWarehouseID, err)
}
if flagGroupCode == "" {
return nil
}
if _, err := fifoSvc.Reflow(ctx, commonSvc.FifoStockV2ReflowRequest{
FlagGroupCode: flagGroupCode,
@@ -778,6 +781,9 @@ func resolveFlagGroupByProductWarehouse(ctx context.Context, tx *gorm.DB, produc
Order("rr.id ASC").
Limit(1).
Take(&selected).Error
if err == gorm.ErrRecordNotFound {
return "", nil
}
if err != nil {
return "", err
}