Add special orders API and related media/auth updates.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
ffc5f8977e
commit
63253f1877
@@ -0,0 +1,55 @@
|
||||
import { IsArray, IsEnum, IsOptional, IsString, MinLength, ValidateNested } from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { SpecialOrderCategory } from '@prisma/client';
|
||||
|
||||
export class SpecialOrderImageDto {
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
url!: string;
|
||||
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
storageKey!: string;
|
||||
}
|
||||
|
||||
export class CreateSpecialOrderDto {
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
userId!: string;
|
||||
|
||||
@IsEnum(SpecialOrderCategory, { message: 'دستهبندی نامعتبر است' })
|
||||
category!: SpecialOrderCategory;
|
||||
|
||||
@IsString()
|
||||
@MinLength(1, { message: 'نام الزامی است' })
|
||||
name!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SpecialOrderImageDto)
|
||||
images?: SpecialOrderImageDto[];
|
||||
}
|
||||
|
||||
export class CreateMySpecialOrderDto {
|
||||
@IsEnum(SpecialOrderCategory, { message: 'دستهبندی نامعتبر است' })
|
||||
category!: SpecialOrderCategory;
|
||||
|
||||
@IsString()
|
||||
@MinLength(1, { message: 'نام الزامی است' })
|
||||
name!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => SpecialOrderImageDto)
|
||||
images?: SpecialOrderImageDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user