fix(admin-products): add class-validator ProductDto to allow product creation and updates through ValidationPipe
Deploy Canina / deploy (push) Successful in 32s
Deploy Canina / deploy (push) Successful in 32s
This commit is contained in:
1 parent
4cbde63b89
commit
d5c05b7577
3 files changed
+176
-33
No files matched your search
@@ -0,0 +1,165 @@
|
||||
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()
|
||||
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()
|
||||
priceValueMarginPercent?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: 'درصد سود قیمت عمدهفروشی' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
wholesaleMarginPercent?: number;
|
||||
|
||||
@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()
|
||||
videoUrl?: string | null;
|
||||
|
||||
@ApiPropertyOptional({ description: 'لینک فایل PDF' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
pdfUrl?: 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: 'آیا پیشخرید فعال است؟' })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isPreorder?: boolean;
|
||||
|
||||
@ApiPropertyOptional({ description: 'مبلغ بیعانه پیشخرید' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
preorderDeposit?: string;
|
||||
}
|
||||
Reference in new issue
Block a user