- 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.
371 lines
10 KiB
TypeScript
371 lines
10 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import {
|
|
IsString,
|
|
IsOptional,
|
|
IsNumber,
|
|
IsArray,
|
|
IsBoolean,
|
|
} from "class-validator";
|
|
|
|
export class ProductDto {
|
|
@ApiPropertyOptional({ description: "شماره آرتیکل محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
artNo?: string;
|
|
|
|
@ApiPropertyOptional({ description: "نام فارسی محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
nameFa?: string;
|
|
|
|
@ApiPropertyOptional({ description: "نام انگلیسی محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
nameEn?: string;
|
|
|
|
@ApiPropertyOptional({ description: "شعار علمی محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
scientificTagline?: string;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات کامل محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
description?: string;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات کوتاه محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
shortDescription?: string;
|
|
|
|
@ApiPropertyOptional({ description: "متن ترکیبات و مواد تشکیلدهنده محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
ingredients?: string;
|
|
|
|
@ApiPropertyOptional({ description: "لیست ترکیبات کلیدی و مواد مؤثره محصول" })
|
|
@IsOptional()
|
|
@IsArray()
|
|
ingredientList?: string[];
|
|
|
|
@ApiPropertyOptional({ description: "شناسه دستهبندی" })
|
|
@IsOptional()
|
|
@IsString()
|
|
categoryId?: string;
|
|
|
|
@ApiPropertyOptional({ description: "اسلاگ دستهبندی" })
|
|
@IsOptional()
|
|
@IsString()
|
|
categorySlug?: string;
|
|
|
|
@ApiPropertyOptional({ description: "قیمت خرید محصول" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
buyPrice?: number;
|
|
|
|
@ApiPropertyOptional({ description: "قیمت فروش محصول" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
priceValue?: number;
|
|
|
|
@ApiPropertyOptional({ description: "قیمت عمدهفروشی محصول" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
wholesalePrice?: number;
|
|
|
|
@ApiPropertyOptional({ description: "درصد سود قیمت مصرفکننده" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
marginRetailPercent?: number;
|
|
|
|
@ApiPropertyOptional({ description: "درصد سود قیمت مصرفکننده (نام دیگر)" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
priceValueMarginPercent?: number;
|
|
|
|
@ApiPropertyOptional({ description: "درصد سود قیمت عمدهفروشی" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
marginWholesalePercent?: number;
|
|
|
|
@ApiPropertyOptional({ description: "درصد سود قیمت عمدهفروشی (نام دیگر)" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
wholesaleMarginPercent?: number;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "گام گرد کردن اختصاصی این محصول (اختیاری)",
|
|
})
|
|
@IsOptional()
|
|
@IsNumber()
|
|
roundingStep?: number;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "جهت گرد کردن اختصاصی این محصول (اختیاری)",
|
|
enum: ["UP", "DOWN", "NEAREST"],
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
roundingMode?: string;
|
|
|
|
@ApiPropertyOptional({ description: "نمایش متنی قیمت" })
|
|
@IsOptional()
|
|
@IsString()
|
|
priceDisplay?: string;
|
|
|
|
@ApiPropertyOptional({ description: "واحد شمارش محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
unit?: string;
|
|
|
|
@ApiPropertyOptional({ description: "اندازه و وزن بسته" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
packageSize?: number;
|
|
|
|
@ApiPropertyOptional({ description: "منطق دوزبندی و نحوه مصرف" })
|
|
@IsOptional()
|
|
@IsString()
|
|
dosageLogic?: string;
|
|
|
|
@ApiPropertyOptional({ description: "مناسب برای گونه حیوان" })
|
|
@IsOptional()
|
|
@IsString()
|
|
suitableFor?: string;
|
|
|
|
@ApiPropertyOptional({ description: "لینک تصویر اصلی محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
imageUrl?: string;
|
|
|
|
@ApiPropertyOptional({ description: "گالری تصاویر محصول" })
|
|
@IsOptional()
|
|
@IsArray()
|
|
images?: string[];
|
|
|
|
@ApiPropertyOptional({ description: "لینک پادکست" })
|
|
@IsOptional()
|
|
@IsString()
|
|
podcastUrl?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "عنوان اختصاصی پادکست" })
|
|
@IsOptional()
|
|
@IsString()
|
|
podcastTitle?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات پادکست" })
|
|
@IsOptional()
|
|
@IsString()
|
|
podcastDescription?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "تصویر کاور پادکست" })
|
|
@IsOptional()
|
|
@IsString()
|
|
podcastCover?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "لینک ویدیو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
videoUrl?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "عنوان اختصاصی ویدیو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
videoTitle?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات ویدیو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
videoDescription?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "تصویر کاور/پوستر ویدیو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
videoCover?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "لینک فایل PDF" })
|
|
@IsOptional()
|
|
@IsString()
|
|
pdfUrl?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "عنوان فایل PDF" })
|
|
@IsOptional()
|
|
@IsString()
|
|
pdfTitle?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات فایل PDF" })
|
|
@IsOptional()
|
|
@IsString()
|
|
pdfDescription?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "تصویر پیشنمایش فایل PDF" })
|
|
@IsOptional()
|
|
@IsString()
|
|
pdfCover?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "عنوان سئو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
metaTitle?: string;
|
|
|
|
@ApiPropertyOptional({ description: "توضیحات متای سئو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
metaDescription?: string;
|
|
|
|
@ApiPropertyOptional({ description: "کلمات کلیدی سئو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
keywords?: string;
|
|
|
|
@ApiPropertyOptional({ description: "آدرس کانونیکال سئو" })
|
|
@IsOptional()
|
|
@IsString()
|
|
canonicalUrl?: string;
|
|
|
|
@ApiPropertyOptional({ description: "اسلاگ محصول" })
|
|
@IsOptional()
|
|
@IsString()
|
|
slug?: string;
|
|
|
|
@ApiPropertyOptional({ description: "علائم درمانی مرتبط" })
|
|
@IsOptional()
|
|
@IsArray()
|
|
symptoms?: string[];
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"وضعیت موجودی کالا (IN_STOCK, OUT_OF_STOCK, PRE_ORDER, DISCONTINUED)",
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
stockStatus?: "IN_STOCK" | "OUT_OF_STOCK" | "PRE_ORDER" | "DISCONTINUED";
|
|
|
|
@ApiPropertyOptional({ description: "تعداد موجودی در انبار" })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
stock?: number;
|
|
|
|
@ApiPropertyOptional({ description: "عدم ایندکس توسط موتورهای جستجو" })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
noIndex?: boolean;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "عدم دنبال کردن لینکها توسط موتورهای جستجو",
|
|
})
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
noFollow?: boolean;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "تصویر کارت شبکههای اجتماعی (og:image)",
|
|
})
|
|
@IsOptional()
|
|
@IsString()
|
|
ogImage?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "متن جایگزین تصویر اصلی (alt)" })
|
|
@IsOptional()
|
|
@IsString()
|
|
featuredImageAlt?: string | null;
|
|
|
|
@ApiPropertyOptional({ description: "آیا پیشخرید فعال است؟" })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isPreorder?: boolean;
|
|
|
|
@ApiPropertyOptional({ description: "مبلغ بیعانه پیشخرید" })
|
|
@IsOptional()
|
|
@IsString()
|
|
preorderDeposit?: string;
|
|
|
|
@ApiPropertyOptional({ description: "دستور مصرف و توصیه بالینی" })
|
|
@IsOptional()
|
|
@IsString()
|
|
feedingAdvice?: string;
|
|
|
|
@ApiPropertyOptional({ description: "نمایش بخش سوالات متداول" })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
showFaqs?: boolean;
|
|
|
|
@ApiPropertyOptional({ description: "پرسش و پاسخهای متداول محصول" })
|
|
@IsOptional()
|
|
@IsArray()
|
|
faqs?: Array<{ question: string; answer: string }>;
|
|
|
|
@ApiPropertyOptional({ description: "مدت زمان ماندگاری پس از باز شدن (PAO)" })
|
|
@IsOptional()
|
|
paoMonths?: number | string;
|
|
|
|
@ApiPropertyOptional({ description: "شرایط نگهداری استاندارد" })
|
|
@IsOptional()
|
|
@IsString()
|
|
storageInfo?: string;
|
|
|
|
@ApiPropertyOptional({ description: "تداخلات و توصیههای احتیاطی" })
|
|
@IsOptional()
|
|
@IsString()
|
|
precautions?: string;
|
|
|
|
@ApiPropertyOptional({ description: "رده سنی و شرایط مصرف" })
|
|
@IsOptional()
|
|
@IsString()
|
|
lifeStage?: string;
|
|
|
|
@ApiPropertyOptional({ description: "نکات کلیدی بالای صفحه (Bullet Points)" })
|
|
@IsOptional()
|
|
@IsArray()
|
|
keyHighlights?: string[];
|
|
|
|
@ApiPropertyOptional({
|
|
description: "کارتهای شاخص «چرا این محصول؟» (۳ کارت مزایا)",
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
keyBenefits?: Array<{ icon: string; title: string; description: string }>;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "جدول آنالیز و درصد ترکیبات (Analytical Constituents)",
|
|
})
|
|
@IsOptional()
|
|
analysis?: Record<string, string>;
|
|
|
|
@ApiPropertyOptional({ description: "زمان شروع اثربخشی (Onset of Action)" })
|
|
@IsOptional()
|
|
@IsString()
|
|
onSetOfAction?: string;
|
|
|
|
@ApiPropertyOptional({ description: "برچسب ویژه محصول (Special Badge)" })
|
|
@IsOptional()
|
|
@IsString()
|
|
specialBadge?: string;
|
|
|
|
@ApiPropertyOptional({ description: "موارد منع مصرف (Contraindications)" })
|
|
@IsOptional()
|
|
contraindications?: string[] | string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "نتایج بالینی مورد انتظار (Expected Clinical Results)",
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
expectedResults?: Array<{ icon: string; text: string }>;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "توصیه و نظر پزشک متخصص (Specialist Endorsement)",
|
|
})
|
|
@IsOptional()
|
|
specialist?: {
|
|
name?: string;
|
|
title?: string;
|
|
image?: string;
|
|
message?: string;
|
|
};
|
|
|
|
@ApiPropertyOptional({ description: "پیکربندی جامع دوز و دادههای تکمیلی" })
|
|
@IsOptional()
|
|
dosageConfig?: Record<string, any>;
|
|
}
|