chore(clean): pass all lint, typecheck and build checks with zero errors
Deploy Canina / deploy (push) Successful in 35s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s

This commit is contained in:
parsa aghaei committed 2026-09-02 10:57:21 +03:30
1 parent 6fa1f2c906
commit a7d842ba10
19 files changed
+5185 -5110

No files matched your search

+9 -9
View File
@@ -179,10 +179,11 @@ export class AdminService {
]);
const enrichedUsers = data.map((u) => {
const totalSpent = u.orders?.reduce(
(acc, curr) => acc + (Number(curr.totalAmount) || 0),
0,
) || 0;
const totalSpent =
u.orders?.reduce(
(acc, curr) => acc + (Number(curr.totalAmount) || 0),
0,
) || 0;
const { orders, ...rest } = u;
return {
...rest,
@@ -1194,8 +1195,7 @@ export class AdminService {
dto.roundingStep !== undefined
? Number(dto.roundingStep)
: pricingSettings.roundingStep;
const globalRoundingMode = (dto.roundingMode ||
pricingSettings.roundingMode) as RoundingMode;
const globalRoundingMode = dto.roundingMode || pricingSettings.roundingMode;
const retailMargin = Number(dto.retailMarginPercent);
const wholesaleMargin = Number(dto.wholesaleMarginPercent);
@@ -1285,7 +1285,8 @@ export class AdminService {
roundingStep: updatedPricing.roundingStep,
roundingMode: updatedPricing.roundingMode,
defaultRetailMarginPercent: updatedPricing.defaultRetailMarginPercent,
defaultWholesaleMarginPercent: updatedPricing.defaultWholesaleMarginPercent,
defaultWholesaleMarginPercent:
updatedPricing.defaultWholesaleMarginPercent,
};
await this.prisma.setting.upsert({
where: { key: 'pricing_config' },
@@ -1313,8 +1314,7 @@ export class AdminService {
dto.roundingStep !== undefined
? Number(dto.roundingStep)
: pricingSettings.roundingStep;
const roundingMode = (dto.roundingMode ||
pricingSettings.roundingMode) as RoundingMode;
const roundingMode = dto.roundingMode || pricingSettings.roundingMode;
const applyRound = dto.applyRounding !== false;
const adjValue = Number(dto.value || 0);
+34 -11
View File
@@ -35,7 +35,8 @@ export class UpdatePricingSettingsDto {
defaultWholesaleMarginPercent!: number;
@ApiPropertyOptional({
description: 'آیا قیمت تمام محصولات بر اساس فرمول جدید بلافاصله به‌روزرسانی شود؟',
description:
'آیا قیمت تمام محصولات بر اساس فرمول جدید بلافاصله به‌روزرسانی شود؟',
default: true,
})
@IsOptional()
@@ -44,12 +45,18 @@ export class UpdatePricingSettingsDto {
}
export class ApplyGlobalMarginsDto {
@ApiProperty({ description: 'درصد سود تک‌فروشی برای اعمال سراسری', example: 30 })
@ApiProperty({
description: 'درصد سود تک‌فروشی برای اعمال سراسری',
example: 30,
})
@IsNumber()
@Min(0)
retailMarginPercent!: number;
@ApiProperty({ description: 'درصد سود عمده‌فروشی برای اعمال سراسری', example: 15 })
@ApiProperty({
description: 'درصد سود عمده‌فروشی برای اعمال سراسری',
example: 15,
})
@IsNumber()
@Min(0)
wholesaleMarginPercent!: number;
@@ -79,12 +86,16 @@ export class ApplyGlobalMarginsDto {
@IsIn(['ALL', 'CATEGORY', 'SPECIFIC'])
scope?: 'ALL' | 'CATEGORY' | 'SPECIFIC';
@ApiPropertyOptional({ description: 'شناسه دسته‌بندی‌ها در صورت انتخاب دامنه CATEGORY' })
@ApiPropertyOptional({
description: 'شناسه دسته‌بندی‌ها در صورت انتخاب دامنه CATEGORY',
})
@IsOptional()
@IsArray()
categoryIds?: string[];
@ApiPropertyOptional({ description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC' })
@ApiPropertyOptional({
description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC',
})
@IsOptional()
@IsArray()
productIds?: string[];
@@ -100,12 +111,16 @@ export class BulkPriceAdjustmentDto {
@IsIn(['ALL', 'CATEGORY', 'SPECIFIC'])
scope!: 'ALL' | 'CATEGORY' | 'SPECIFIC';
@ApiPropertyOptional({ description: 'شناسه دسته‌بندی‌ها در صورت انتخاب دامنه CATEGORY' })
@ApiPropertyOptional({
description: 'شناسه دسته‌بندی‌ها در صورت انتخاب دامنه CATEGORY',
})
@IsOptional()
@IsArray()
categoryIds?: string[];
@ApiPropertyOptional({ description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC' })
@ApiPropertyOptional({
description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC',
})
@IsOptional()
@IsArray()
productIds?: string[];
@@ -129,7 +144,8 @@ export class BulkPriceAdjustmentDto {
adjustmentType!: 'PERCENT' | 'FIXED';
@ApiProperty({
description: 'جهت تغییر: INCREASE (افزایش / گران‌تر) یا DECREASE (کاهش / ارزان‌تر)',
description:
'جهت تغییر: INCREASE (افزایش / گران‌تر) یا DECREASE (کاهش / ارزان‌تر)',
enum: ['INCREASE', 'DECREASE'],
example: 'INCREASE',
})
@@ -138,19 +154,26 @@ export class BulkPriceAdjustmentDto {
adjustmentDirection!: 'INCREASE' | 'DECREASE';
@ApiProperty({
description: 'مقدار تغییر (مثلاً 10 برای 10 درصد، یا 100000 برای 100 هزار تومان)',
description:
'مقدار تغییر (مثلاً 10 برای 10 درصد، یا 100000 برای 100 هزار تومان)',
example: 10,
})
@IsNumber()
@Min(0)
value!: number;
@ApiPropertyOptional({ description: 'آیا پس از تغییر قیمت، گرد کردن اعمال شود؟', default: true })
@ApiPropertyOptional({
description: 'آیا پس از تغییر قیمت، گرد کردن اعمال شود؟',
default: true,
})
@IsOptional()
@IsBoolean()
applyRounding?: boolean;
@ApiPropertyOptional({ description: 'گام گرد کردن سفارشی (در صورت خالی بودن از تنظیمات سیستم استفاده می‌شود)' })
@ApiPropertyOptional({
description:
'گام گرد کردن سفارشی (در صورت خالی بودن از تنظیمات سیستم استفاده می‌شود)',
})
@IsOptional()
@IsNumber()
roundingStep?: number;
+3 -1
View File
@@ -83,7 +83,9 @@ export class ProductDto {
@IsNumber()
wholesaleMarginPercent?: number;
@ApiPropertyOptional({ description: 'گام گرد کردن اختصاصی این محصول (اختیاری)' })
@ApiPropertyOptional({
description: 'گام گرد کردن اختصاصی این محصول (اختیاری)',
})
@IsOptional()
@IsNumber()
roundingStep?: number;