fix(pricing): persist pricing_config on applyGlobalMargins and fix nullish coalescing in settings
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei committed 2026-09-02 10:42:33 +03:30
1 parent 0da7cf14e8
commit 2a501637cb
14 files changed
+7089 -7010

No files matched your search

+26
View File
@@ -1273,11 +1273,37 @@ export class AdminService {
}
}
let updatedPricing = pricingSettings;
if (dto.scope === 'ALL' || !dto.scope) {
updatedPricing = {
roundingStep: globalRoundingStep,
roundingMode: globalRoundingMode,
defaultRetailMarginPercent: retailMargin,
defaultWholesaleMarginPercent: wholesaleMargin,
};
const jsonVal = {
roundingStep: updatedPricing.roundingStep,
roundingMode: updatedPricing.roundingMode,
defaultRetailMarginPercent: updatedPricing.defaultRetailMarginPercent,
defaultWholesaleMarginPercent: updatedPricing.defaultWholesaleMarginPercent,
};
await this.prisma.setting.upsert({
where: { key: 'pricing_config' },
update: { category: 'pricing', value: jsonVal },
create: {
key: 'pricing_config',
category: 'pricing',
value: jsonVal,
},
});
}
return {
success: true,
message: `درصد سود با موفقیت بر روی ${updatedCount} محصول اعمال و قیمت‌ها گرد شدند.`,
updatedCount,
totalMatched: products.length,
data: updatedPricing,
};
}