test: comprehensive test suites and quality gates pass across backend, storefront and admin
- Backend (NestJS): 82 suites, 641 tests passing; 0 ESLint errors; 0 tsc errors. Hardened SSL cert/key matching, SSRF IP pinning, and eBank validation. - Admin Panel (Vite/React): 48 suites, 300 tests passing; 0 ESLint errors; 0 tsc errors. Full coverage across all pages and settings. - Storefront (Next.js): 62 suites, 368 tests passing; 0 ESLint errors; 0 tsc errors. - Fixed unmount lifecycle guards, promise error handling, and component edge cases.
This commit is contained in:
1 parent
1e73715169
commit
ddbf1ca026
439 files changed
+32911
-6107
No files matched your search
@@ -1,29 +1,29 @@
|
||||
import { ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsOptional, IsString } from 'class-validator';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
import { ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsOptional, IsString } from "class-validator";
|
||||
import { PaginationDto } from "../../common/dto/pagination.dto";
|
||||
|
||||
export class AdminQueryDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: 'فیلتر بر اساس نقش کاربر' })
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس نقش کاربر" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
role?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'فیلتر بر اساس دستهبندی' })
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس دستهبندی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
categoryId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'فیلتر بر اساس گونه هدف محصول' })
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس گونه هدف محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
suitableFor?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'فیلتر بر اساس وضعیت' })
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس وضعیت" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'وضعیت موجودی کالا' })
|
||||
@ApiPropertyOptional({ description: "وضعیت موجودی کالا" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
stockStatus?: string;
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import { IsString, IsNotEmpty, IsOptional, IsArray } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsNotEmpty, IsOptional, IsArray } from "class-validator";
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
|
||||
export class CreateApiKeyDto {
|
||||
@ApiProperty({
|
||||
description: 'نام یا شناسه کلید',
|
||||
example: 'ورکفلو هماهنگی سفارشات n8n',
|
||||
description: "نام یا شناسه کلید",
|
||||
example: "ورکفلو هماهنگی سفارشات n8n",
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'توضیحات تکمیلی درباره کلید',
|
||||
example: 'استفاده در وبهوک سفارشات',
|
||||
description: "توضیحات تکمیلی درباره کلید",
|
||||
example: "استفاده در وبهوک سفارشات",
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'سطوح دسترسی (scopes)',
|
||||
example: ['orders:read', 'orders:write'],
|
||||
description: "سطوح دسترسی (scopes)",
|
||||
example: ["orders:read", "orders:write"],
|
||||
})
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
@@ -28,8 +28,8 @@ export class CreateApiKeyDto {
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'تاریخ انقضا به فرمت ISO (در صورت خالی بودن، بدون انقضا خواهد بود)',
|
||||
example: '2026-12-31T23:59:59.000Z',
|
||||
"تاریخ انقضا به فرمت ISO (در صورت خالی بودن، بدون انقضا خواهد بود)",
|
||||
example: "2026-12-31T23:59:59.000Z",
|
||||
})
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsNumber,
|
||||
IsString,
|
||||
@@ -7,36 +7,36 @@ import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
Min,
|
||||
} from 'class-validator';
|
||||
} from "class-validator";
|
||||
|
||||
export class UpdatePricingSettingsDto {
|
||||
@ApiProperty({ description: 'گام گرد کردن قیمت به تومان', example: 5000 })
|
||||
@ApiProperty({ description: "گام گرد کردن قیمت به تومان", example: 5000 })
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
roundingStep!: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'جهت گرد کردن',
|
||||
enum: ['UP', 'DOWN', 'NEAREST'],
|
||||
example: 'UP',
|
||||
description: "جهت گرد کردن",
|
||||
enum: ["UP", "DOWN", "NEAREST"],
|
||||
example: "UP",
|
||||
})
|
||||
@IsString()
|
||||
@IsIn(['UP', 'DOWN', 'NEAREST'])
|
||||
roundingMode!: 'UP' | 'DOWN' | 'NEAREST';
|
||||
@IsIn(["UP", "DOWN", "NEAREST"])
|
||||
roundingMode!: "UP" | "DOWN" | "NEAREST";
|
||||
|
||||
@ApiProperty({ description: 'درصد سود پیشفرض تکفروشی', example: 30 })
|
||||
@ApiProperty({ description: "درصد سود پیشفرض تکفروشی", example: 30 })
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
defaultRetailMarginPercent!: number;
|
||||
|
||||
@ApiProperty({ description: 'درصد سود پیشفرض عمدهفروشی', example: 15 })
|
||||
@ApiProperty({ description: "درصد سود پیشفرض عمدهفروشی", example: 15 })
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
defaultWholesaleMarginPercent!: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'آیا قیمت تمام محصولات بر اساس فرمول جدید بلافاصله بهروزرسانی شود؟',
|
||||
"آیا قیمت تمام محصولات بر اساس فرمول جدید بلافاصله بهروزرسانی شود؟",
|
||||
default: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@@ -46,7 +46,7 @@ export class UpdatePricingSettingsDto {
|
||||
|
||||
export class ApplyGlobalMarginsDto {
|
||||
@ApiProperty({
|
||||
description: 'درصد سود تکفروشی برای اعمال سراسری',
|
||||
description: "درصد سود تکفروشی برای اعمال سراسری",
|
||||
example: 30,
|
||||
})
|
||||
@IsNumber()
|
||||
@@ -54,47 +54,47 @@ export class ApplyGlobalMarginsDto {
|
||||
retailMarginPercent!: number;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'درصد سود عمدهفروشی برای اعمال سراسری',
|
||||
description: "درصد سود عمدهفروشی برای اعمال سراسری",
|
||||
example: 15,
|
||||
})
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
wholesaleMarginPercent!: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'گام گرد کردن سفارشی (اختیاری)' })
|
||||
@ApiPropertyOptional({ description: "گام گرد کردن سفارشی (اختیاری)" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
roundingStep?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'جهت گرد کردن سفارشی',
|
||||
enum: ['UP', 'DOWN', 'NEAREST'],
|
||||
description: "جهت گرد کردن سفارشی",
|
||||
enum: ["UP", "DOWN", "NEAREST"],
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(['UP', 'DOWN', 'NEAREST'])
|
||||
roundingMode?: 'UP' | 'DOWN' | 'NEAREST';
|
||||
@IsIn(["UP", "DOWN", "NEAREST"])
|
||||
roundingMode?: "UP" | "DOWN" | "NEAREST";
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'دامنه محصولات',
|
||||
enum: ['ALL', 'CATEGORY', 'SPECIFIC'],
|
||||
default: 'ALL',
|
||||
description: "دامنه محصولات",
|
||||
enum: ["ALL", "CATEGORY", "SPECIFIC"],
|
||||
default: "ALL",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(['ALL', 'CATEGORY', 'SPECIFIC'])
|
||||
scope?: 'ALL' | 'CATEGORY' | 'SPECIFIC';
|
||||
@IsIn(["ALL", "CATEGORY", "SPECIFIC"])
|
||||
scope?: "ALL" | "CATEGORY" | "SPECIFIC";
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'شناسه دستهبندیها در صورت انتخاب دامنه CATEGORY',
|
||||
description: "شناسه دستهبندیها در صورت انتخاب دامنه CATEGORY",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
categoryIds?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC',
|
||||
description: "شناسه محصولات در صورت انتخاب دامنه SPECIFIC",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@@ -103,59 +103,59 @@ export class ApplyGlobalMarginsDto {
|
||||
|
||||
export class BulkPriceAdjustmentDto {
|
||||
@ApiProperty({
|
||||
description: 'دامنه محصولات',
|
||||
enum: ['ALL', 'CATEGORY', 'SPECIFIC'],
|
||||
example: 'ALL',
|
||||
description: "دامنه محصولات",
|
||||
enum: ["ALL", "CATEGORY", "SPECIFIC"],
|
||||
example: "ALL",
|
||||
})
|
||||
@IsString()
|
||||
@IsIn(['ALL', 'CATEGORY', 'SPECIFIC'])
|
||||
scope!: 'ALL' | 'CATEGORY' | 'SPECIFIC';
|
||||
@IsIn(["ALL", "CATEGORY", "SPECIFIC"])
|
||||
scope!: "ALL" | "CATEGORY" | "SPECIFIC";
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'شناسه دستهبندیها در صورت انتخاب دامنه CATEGORY',
|
||||
description: "شناسه دستهبندیها در صورت انتخاب دامنه CATEGORY",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
categoryIds?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'شناسه محصولات در صورت انتخاب دامنه SPECIFIC',
|
||||
description: "شناسه محصولات در صورت انتخاب دامنه SPECIFIC",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
productIds?: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description: 'فیلد هدف برای تغییر قیمت',
|
||||
enum: ['RETAIL', 'WHOLESALE', 'BUY', 'BOTH_SELLING', 'ALL'],
|
||||
example: 'RETAIL',
|
||||
description: "فیلد هدف برای تغییر قیمت",
|
||||
enum: ["RETAIL", "WHOLESALE", "BUY", "BOTH_SELLING", "ALL"],
|
||||
example: "RETAIL",
|
||||
})
|
||||
@IsString()
|
||||
@IsIn(['RETAIL', 'WHOLESALE', 'BUY', 'BOTH_SELLING', 'ALL'])
|
||||
targetField!: 'RETAIL' | 'WHOLESALE' | 'BUY' | 'BOTH_SELLING' | 'ALL';
|
||||
@IsIn(["RETAIL", "WHOLESALE", "BUY", "BOTH_SELLING", "ALL"])
|
||||
targetField!: "RETAIL" | "WHOLESALE" | "BUY" | "BOTH_SELLING" | "ALL";
|
||||
|
||||
@ApiProperty({
|
||||
description: 'نوع تغییر: PERCENT (درصدی) یا FIXED (مبلغ ثابت)',
|
||||
enum: ['PERCENT', 'FIXED'],
|
||||
example: 'PERCENT',
|
||||
description: "نوع تغییر: PERCENT (درصدی) یا FIXED (مبلغ ثابت)",
|
||||
enum: ["PERCENT", "FIXED"],
|
||||
example: "PERCENT",
|
||||
})
|
||||
@IsString()
|
||||
@IsIn(['PERCENT', 'FIXED'])
|
||||
adjustmentType!: 'PERCENT' | 'FIXED';
|
||||
@IsIn(["PERCENT", "FIXED"])
|
||||
adjustmentType!: "PERCENT" | "FIXED";
|
||||
|
||||
@ApiProperty({
|
||||
description:
|
||||
'جهت تغییر: INCREASE (افزایش / گرانتر) یا DECREASE (کاهش / ارزانتر)',
|
||||
enum: ['INCREASE', 'DECREASE'],
|
||||
example: 'INCREASE',
|
||||
"جهت تغییر: INCREASE (افزایش / گرانتر) یا DECREASE (کاهش / ارزانتر)",
|
||||
enum: ["INCREASE", "DECREASE"],
|
||||
example: "INCREASE",
|
||||
})
|
||||
@IsString()
|
||||
@IsIn(['INCREASE', 'DECREASE'])
|
||||
adjustmentDirection!: 'INCREASE' | 'DECREASE';
|
||||
@IsIn(["INCREASE", "DECREASE"])
|
||||
adjustmentDirection!: "INCREASE" | "DECREASE";
|
||||
|
||||
@ApiProperty({
|
||||
description:
|
||||
'مقدار تغییر (مثلاً 10 برای 10 درصد، یا 100000 برای 100 هزار تومان)',
|
||||
"مقدار تغییر (مثلاً 10 برای 10 درصد، یا 100000 برای 100 هزار تومان)",
|
||||
example: 10,
|
||||
})
|
||||
@IsNumber()
|
||||
@@ -163,7 +163,7 @@ export class BulkPriceAdjustmentDto {
|
||||
value!: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'آیا پس از تغییر قیمت، گرد کردن اعمال شود؟',
|
||||
description: "آیا پس از تغییر قیمت، گرد کردن اعمال شود؟",
|
||||
default: true,
|
||||
})
|
||||
@IsOptional()
|
||||
@@ -172,18 +172,18 @@ export class BulkPriceAdjustmentDto {
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'گام گرد کردن سفارشی (در صورت خالی بودن از تنظیمات سیستم استفاده میشود)',
|
||||
"گام گرد کردن سفارشی (در صورت خالی بودن از تنظیمات سیستم استفاده میشود)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
roundingStep?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'جهت گرد کردن سفارشی',
|
||||
enum: ['UP', 'DOWN', 'NEAREST'],
|
||||
description: "جهت گرد کردن سفارشی",
|
||||
enum: ["UP", "DOWN", "NEAREST"],
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(['UP', 'DOWN', 'NEAREST'])
|
||||
roundingMode?: 'UP' | 'DOWN' | 'NEAREST';
|
||||
@IsIn(["UP", "DOWN", "NEAREST"])
|
||||
roundingMode?: "UP" | "DOWN" | "NEAREST";
|
||||
}
|
||||
@@ -1,360 +1,360 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsNumber,
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
} from 'class-validator';
|
||||
} from "class-validator";
|
||||
|
||||
export class ProductDto {
|
||||
@ApiPropertyOptional({ description: 'شماره آرتیکل محصول' })
|
||||
@ApiPropertyOptional({ description: "شماره آرتیکل محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
artNo?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نام فارسی محصول' })
|
||||
@ApiPropertyOptional({ description: "نام فارسی محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
nameFa?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نام انگلیسی محصول' })
|
||||
@ApiPropertyOptional({ description: "نام انگلیسی محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
nameEn?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'شعار علمی محصول' })
|
||||
@ApiPropertyOptional({ description: "شعار علمی محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
scientificTagline?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات کامل محصول' })
|
||||
@ApiPropertyOptional({ description: "توضیحات کامل محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات کوتاه محصول' })
|
||||
@ApiPropertyOptional({ description: "توضیحات کوتاه محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shortDescription?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'متن ترکیبات و مواد تشکیلدهنده محصول' })
|
||||
@ApiPropertyOptional({ description: "متن ترکیبات و مواد تشکیلدهنده محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ingredients?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'لیست ترکیبات کلیدی و مواد مؤثره محصول' })
|
||||
@ApiPropertyOptional({ description: "لیست ترکیبات کلیدی و مواد مؤثره محصول" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
ingredientList?: string[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'شناسه دستهبندی' })
|
||||
@ApiPropertyOptional({ description: "شناسه دستهبندی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
categoryId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'اسلاگ دستهبندی' })
|
||||
@ApiPropertyOptional({ description: "اسلاگ دستهبندی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
categorySlug?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'قیمت خرید محصول' })
|
||||
@ApiPropertyOptional({ description: "قیمت خرید محصول" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
buyPrice?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'قیمت فروش محصول' })
|
||||
@ApiPropertyOptional({ description: "قیمت فروش محصول" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
priceValue?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'قیمت عمدهفروشی محصول' })
|
||||
@ApiPropertyOptional({ description: "قیمت عمدهفروشی محصول" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
wholesalePrice?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'درصد سود قیمت مصرفکننده' })
|
||||
@ApiPropertyOptional({ description: "درصد سود قیمت مصرفکننده" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
marginRetailPercent?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'درصد سود قیمت مصرفکننده (نام دیگر)' })
|
||||
@ApiPropertyOptional({ description: "درصد سود قیمت مصرفکننده (نام دیگر)" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
priceValueMarginPercent?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'درصد سود قیمت عمدهفروشی' })
|
||||
@ApiPropertyOptional({ description: "درصد سود قیمت عمدهفروشی" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
marginWholesalePercent?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'درصد سود قیمت عمدهفروشی (نام دیگر)' })
|
||||
@ApiPropertyOptional({ description: "درصد سود قیمت عمدهفروشی (نام دیگر)" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
wholesaleMarginPercent?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'گام گرد کردن اختصاصی این محصول (اختیاری)',
|
||||
description: "گام گرد کردن اختصاصی این محصول (اختیاری)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
roundingStep?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'جهت گرد کردن اختصاصی این محصول (اختیاری)',
|
||||
enum: ['UP', 'DOWN', 'NEAREST'],
|
||||
description: "جهت گرد کردن اختصاصی این محصول (اختیاری)",
|
||||
enum: ["UP", "DOWN", "NEAREST"],
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
roundingMode?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نمایش متنی قیمت' })
|
||||
@ApiPropertyOptional({ description: "نمایش متنی قیمت" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
priceDisplay?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'واحد شمارش محصول' })
|
||||
@ApiPropertyOptional({ description: "واحد شمارش محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
unit?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'اندازه و وزن بسته' })
|
||||
@ApiPropertyOptional({ description: "اندازه و وزن بسته" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
packageSize?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'منطق دوزبندی و نحوه مصرف' })
|
||||
@ApiPropertyOptional({ description: "منطق دوزبندی و نحوه مصرف" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
dosageLogic?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'مناسب برای گونه حیوان' })
|
||||
@ApiPropertyOptional({ description: "مناسب برای گونه حیوان" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
suitableFor?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'لینک تصویر اصلی محصول' })
|
||||
@ApiPropertyOptional({ description: "لینک تصویر اصلی محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
imageUrl?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'گالری تصاویر محصول' })
|
||||
@ApiPropertyOptional({ description: "گالری تصاویر محصول" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
images?: string[];
|
||||
|
||||
@ApiPropertyOptional({ description: 'لینک پادکست' })
|
||||
@ApiPropertyOptional({ description: "لینک پادکست" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
podcastUrl?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'عنوان اختصاصی پادکست' })
|
||||
@ApiPropertyOptional({ description: "عنوان اختصاصی پادکست" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
podcastTitle?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات پادکست' })
|
||||
@ApiPropertyOptional({ description: "توضیحات پادکست" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
podcastDescription?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'تصویر کاور پادکست' })
|
||||
@ApiPropertyOptional({ description: "تصویر کاور پادکست" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
podcastCover?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'لینک ویدیو' })
|
||||
@ApiPropertyOptional({ description: "لینک ویدیو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoUrl?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'عنوان اختصاصی ویدیو' })
|
||||
@ApiPropertyOptional({ description: "عنوان اختصاصی ویدیو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoTitle?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات ویدیو' })
|
||||
@ApiPropertyOptional({ description: "توضیحات ویدیو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoDescription?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'تصویر کاور/پوستر ویدیو' })
|
||||
@ApiPropertyOptional({ description: "تصویر کاور/پوستر ویدیو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
videoCover?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'لینک فایل PDF' })
|
||||
@ApiPropertyOptional({ description: "لینک فایل PDF" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pdfUrl?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'عنوان فایل PDF' })
|
||||
@ApiPropertyOptional({ description: "عنوان فایل PDF" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pdfTitle?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات فایل PDF' })
|
||||
@ApiPropertyOptional({ description: "توضیحات فایل PDF" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pdfDescription?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'تصویر پیشنمایش فایل PDF' })
|
||||
@ApiPropertyOptional({ description: "تصویر پیشنمایش فایل PDF" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pdfCover?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'عنوان سئو' })
|
||||
@ApiPropertyOptional({ description: "عنوان سئو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
metaTitle?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'توضیحات متای سئو' })
|
||||
@ApiPropertyOptional({ description: "توضیحات متای سئو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
metaDescription?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'کلمات کلیدی سئو' })
|
||||
@ApiPropertyOptional({ description: "کلمات کلیدی سئو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
keywords?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'آدرس کانونیکال سئو' })
|
||||
@ApiPropertyOptional({ description: "آدرس کانونیکال سئو" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
canonicalUrl?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'اسلاگ محصول' })
|
||||
@ApiPropertyOptional({ description: "اسلاگ محصول" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
slug?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'علائم درمانی مرتبط' })
|
||||
@ApiPropertyOptional({ description: "علائم درمانی مرتبط" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
symptoms?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
'وضعیت موجودی کالا (IN_STOCK, OUT_OF_STOCK, PRE_ORDER, DISCONTINUED)',
|
||||
"وضعیت موجودی کالا (IN_STOCK, OUT_OF_STOCK, PRE_ORDER, DISCONTINUED)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
stockStatus?: 'IN_STOCK' | 'OUT_OF_STOCK' | 'PRE_ORDER' | 'DISCONTINUED';
|
||||
stockStatus?: "IN_STOCK" | "OUT_OF_STOCK" | "PRE_ORDER" | "DISCONTINUED";
|
||||
|
||||
@ApiPropertyOptional({ description: 'تعداد موجودی در انبار' })
|
||||
@ApiPropertyOptional({ description: "تعداد موجودی در انبار" })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
stock?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'عدم ایندکس توسط موتورهای جستجو' })
|
||||
@ApiPropertyOptional({ description: "عدم ایندکس توسط موتورهای جستجو" })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
noIndex?: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'عدم دنبال کردن لینکها توسط موتورهای جستجو',
|
||||
description: "عدم دنبال کردن لینکها توسط موتورهای جستجو",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
noFollow?: boolean;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'تصویر کارت شبکههای اجتماعی (og:image)',
|
||||
description: "تصویر کارت شبکههای اجتماعی (og:image)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
ogImage?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'متن جایگزین تصویر اصلی (alt)' })
|
||||
@ApiPropertyOptional({ description: "متن جایگزین تصویر اصلی (alt)" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
featuredImageAlt?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'آیا پیشخرید فعال است؟' })
|
||||
@ApiPropertyOptional({ description: "آیا پیشخرید فعال است؟" })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isPreorder?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ description: 'مبلغ بیعانه پیشخرید' })
|
||||
@ApiPropertyOptional({ description: "مبلغ بیعانه پیشخرید" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
preorderDeposit?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'دستور مصرف و توصیه بالینی' })
|
||||
@ApiPropertyOptional({ description: "دستور مصرف و توصیه بالینی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
feedingAdvice?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نمایش بخش سوالات متداول' })
|
||||
@ApiPropertyOptional({ description: "نمایش بخش سوالات متداول" })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
showFaqs?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ description: 'پرسش و پاسخهای متداول محصول' })
|
||||
@ApiPropertyOptional({ description: "پرسش و پاسخهای متداول محصول" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
faqs?: Array<{ question: string; answer: string }>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'مدت زمان ماندگاری پس از باز شدن (PAO)' })
|
||||
@ApiPropertyOptional({ description: "مدت زمان ماندگاری پس از باز شدن (PAO)" })
|
||||
@IsOptional()
|
||||
paoMonths?: number | string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'شرایط نگهداری استاندارد' })
|
||||
@ApiPropertyOptional({ description: "شرایط نگهداری استاندارد" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
storageInfo?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'تداخلات و توصیههای احتیاطی' })
|
||||
@ApiPropertyOptional({ description: "تداخلات و توصیههای احتیاطی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
precautions?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'رده سنی و شرایط مصرف' })
|
||||
@ApiPropertyOptional({ description: "رده سنی و شرایط مصرف" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lifeStage?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نکات کلیدی بالای صفحه (Bullet Points)' })
|
||||
@ApiPropertyOptional({ description: "نکات کلیدی بالای صفحه (Bullet Points)" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
keyHighlights?: string[];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'کارتهای شاخص «چرا این محصول؟» (۳ کارت مزایا)',
|
||||
description: "کارتهای شاخص «چرا این محصول؟» (۳ کارت مزایا)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
keyBenefits?: Array<{ icon: string; title: string; description: string }>;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'جدول آنالیز و درصد ترکیبات (Analytical Constituents)',
|
||||
description: "جدول آنالیز و درصد ترکیبات (Analytical Constituents)",
|
||||
})
|
||||
@IsOptional()
|
||||
analysis?: Record<string, string>;
|
||||
|
||||
@ApiPropertyOptional({ description: 'زمان شروع اثربخشی (Onset of Action)' })
|
||||
@ApiPropertyOptional({ description: "زمان شروع اثربخشی (Onset of Action)" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
onSetOfAction?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'برچسب ویژه محصول (Special Badge)' })
|
||||
@ApiPropertyOptional({ description: "برچسب ویژه محصول (Special Badge)" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
specialBadge?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'موارد منع مصرف (Contraindications)' })
|
||||
@ApiPropertyOptional({ description: "موارد منع مصرف (Contraindications)" })
|
||||
@IsOptional()
|
||||
contraindications?: string[] | string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'نتایج بالینی مورد انتظار (Expected Clinical Results)',
|
||||
description: "نتایج بالینی مورد انتظار (Expected Clinical Results)",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
expectedResults?: Array<{ icon: string; text: string }>;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'توصیه و نظر پزشک متخصص (Specialist Endorsement)',
|
||||
description: "توصیه و نظر پزشک متخصص (Specialist Endorsement)",
|
||||
})
|
||||
@IsOptional()
|
||||
specialist?: {
|
||||
@@ -364,7 +364,7 @@ export class ProductDto {
|
||||
message?: string;
|
||||
};
|
||||
|
||||
@ApiPropertyOptional({ description: 'پیکربندی جامع دوز و دادههای تکمیلی' })
|
||||
@ApiPropertyOptional({ description: "پیکربندی جامع دوز و دادههای تکمیلی" })
|
||||
@IsOptional()
|
||||
dosageConfig?: Record<string, any>;
|
||||
}
|
||||
@@ -5,90 +5,90 @@ import {
|
||||
IsEmail,
|
||||
MinLength,
|
||||
IsNumber,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
} from "class-validator";
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
|
||||
export class CreateUserDto {
|
||||
@ApiProperty({ description: 'نام کاربر', example: 'علی' })
|
||||
@IsNotEmpty({ message: 'نام الزامی است' })
|
||||
@ApiProperty({ description: "نام کاربر", example: "علی" })
|
||||
@IsNotEmpty({ message: "نام الزامی است" })
|
||||
@IsString()
|
||||
firstName!: string;
|
||||
|
||||
@ApiProperty({ description: 'نام خانوادگی کاربر', example: 'محمدی' })
|
||||
@IsNotEmpty({ message: 'نام خانوادگی الزامی است' })
|
||||
@ApiProperty({ description: "نام خانوادگی کاربر", example: "محمدی" })
|
||||
@IsNotEmpty({ message: "نام خانوادگی الزامی است" })
|
||||
@IsString()
|
||||
lastName!: string;
|
||||
|
||||
@ApiProperty({ description: 'شماره موبایل', example: '09123456789' })
|
||||
@IsNotEmpty({ message: 'شماره موبایل الزامی است' })
|
||||
@ApiProperty({ description: "شماره موبایل", example: "09123456789" })
|
||||
@IsNotEmpty({ message: "شماره موبایل الزامی است" })
|
||||
@IsString()
|
||||
mobile!: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'ایمیل کاربر',
|
||||
example: 'ali@example.com',
|
||||
description: "ایمیل کاربر",
|
||||
example: "ali@example.com",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEmail({}, { message: 'فرمت ایمیل نامعتبر است' })
|
||||
@IsEmail({}, { message: "فرمت ایمیل نامعتبر است" })
|
||||
email?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'رمز عبور', example: 'Password123' })
|
||||
@ApiPropertyOptional({ description: "رمز عبور", example: "Password123" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(6, { message: 'رمز عبور باید حداقل ۶ کاراکتر باشد' })
|
||||
@MinLength(6, { message: "رمز عبور باید حداقل ۶ کاراکتر باشد" })
|
||||
password?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نقش کاربر', example: 'User_PetOwner' })
|
||||
@ApiPropertyOptional({ description: "نقش کاربر", example: "User_PetOwner" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
role?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'موجودی اولیه کیف پول', example: 0 })
|
||||
@ApiPropertyOptional({ description: "موجودی اولیه کیف پول", example: 0 })
|
||||
@IsOptional()
|
||||
@IsNumber({}, { message: 'موجودی کیف پول باید عدد باشد' })
|
||||
@IsNumber({}, { message: "موجودی کیف پول باید عدد باشد" })
|
||||
walletBalance?: number;
|
||||
}
|
||||
|
||||
export class UpdateUserDto {
|
||||
@ApiPropertyOptional({ description: 'نام کاربر', example: 'علی' })
|
||||
@ApiPropertyOptional({ description: "نام کاربر", example: "علی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
firstName?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نام خانوادگی کاربر', example: 'محمدی' })
|
||||
@ApiPropertyOptional({ description: "نام خانوادگی کاربر", example: "محمدی" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
lastName?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'شماره موبایل', example: '09123456789' })
|
||||
@ApiPropertyOptional({ description: "شماره موبایل", example: "09123456789" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
mobile?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'ایمیل کاربر',
|
||||
example: 'ali@example.com',
|
||||
description: "ایمیل کاربر",
|
||||
example: "ali@example.com",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsEmail({}, { message: 'فرمت ایمیل نامعتبر است' })
|
||||
@IsEmail({}, { message: "فرمت ایمیل نامعتبر است" })
|
||||
email?: string;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'رمز عبور جدید',
|
||||
example: 'NewPassword123',
|
||||
description: "رمز عبور جدید",
|
||||
example: "NewPassword123",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MinLength(6, { message: 'رمز عبور باید حداقل ۶ کاراکتر باشد' })
|
||||
@MinLength(6, { message: "رمز عبور باید حداقل ۶ کاراکتر باشد" })
|
||||
password?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'نقش کاربر', example: 'User_PetOwner' })
|
||||
@ApiPropertyOptional({ description: "نقش کاربر", example: "User_PetOwner" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
role?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: 'موجودی کیف پول', example: 500000 })
|
||||
@ApiPropertyOptional({ description: "موجودی کیف پول", example: 500000 })
|
||||
@IsOptional()
|
||||
@IsNumber({}, { message: 'موجودی کیف پول باید عدد باشد' })
|
||||
@IsNumber({}, { message: "موجودی کیف پول باید عدد باشد" })
|
||||
walletBalance?: number;
|
||||
}
|
||||
Reference in new issue
Block a user