product bug

This commit is contained in:
2026-01-24 15:36:07 +03:30
parent bdc76689a5
commit 58e5e3e0d2
5 changed files with 35 additions and 19 deletions
+21 -10
View File
@@ -4,6 +4,7 @@ import {
IsBoolean,
IsInt,
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
Min,
@@ -21,18 +22,28 @@ export class CreateproductDto {
@ApiPropertyOptional({ example: 'کارت ویزیت' })
title: string;
@IsArray()
@IsString({ each: true })
@ApiPropertyOptional({ type: [String] })
desc: string[];
@IsString()
@ApiPropertyOptional()
@IsOptional()
@IsInt()
@Min(0)
desc: string;
@IsString()
@ApiPropertyOptional()
@IsOptional()
linkUrl: string;
@IsArray()
@Type(() => Number)
@ApiPropertyOptional({ example: 15 })
prepareTime?: number;
@IsNumber({}, { each: true })
@ApiPropertyOptional({ type: [Number] })
quantities: number[];
// @IsOptional()
// @IsInt()
// @Min(0)
// @Type(() => Number)
// @ApiPropertyOptional({ example: 15 })
// prepareTime?: number;
@IsOptional()
@IsBoolean()
@@ -18,11 +18,14 @@ export class Product extends BaseEntity {
@Property()
title: string;
@Property({ type: 'json' })
desc: string[]
@Property({ type: 'string' })
desc: string
@Property()
prepareTime: number;
@Property({ type: 'json' })
quantities: number[]
// @Property()
// prepareTime: number;
@Property({ type: 'text', nullable: true })
linkUrl?: string;
@@ -29,7 +29,8 @@ export class ProductService {
order: rest.order ?? null,
title: rest.title,
desc: rest.desc,
prepareTime: rest.prepareTime ?? 0,
// prepareTime: rest.prepareTime ?? 0,
quantities: rest.quantities,
images: rest.images ?? undefined,
category,
};
+3 -3
View File
@@ -4,20 +4,20 @@ export interface productData {
isActive: boolean;
categoryTitle: string,
images: string[];
desc: string[];
desc: string;
}
export const productsData: productData[] = [
{
title: 'کارت ویزیت',
desc: ['توضیح کار ویزیت'],
desc: 'توضیح کار ویزیت',
categoryTitle: 'چاپ',
isActive: true,
images: ["https://dmenu.danakcorp.com/uploads/images/product/product_1715711043900.png"],
},
{
title: 'بروشور',
desc: ['توضیح '],
desc: 'توضیح ',
categoryTitle: 'چاپ',
isActive: true,
images: ["https://dmenu.danakcorp.com/uploads/images/product/product_1715711043900.png"],
+2 -1
View File
@@ -26,7 +26,8 @@ export class ProductsSeeder {
desc: productData.desc,
category,
isActive: productData.isActive,
prepareTime: 10,
// prepareTime: 10,
quantities: [100, 200],
images: productData.images,
order: 1
});