This commit is contained in:
2026-01-26 12:46:59 +03:30
parent 062365d437
commit bae7f470cc
5 changed files with 98 additions and 263 deletions
-91
View File
@@ -1,91 +0,0 @@
import {
IsArray, IsNumber,
IsNotEmpty,
ArrayMinSize,
IsBoolean,
IsString
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
export class ItemDto {
@IsNumber()
@ApiProperty()
orderItemId: number;
@ApiProperty()
@IsNumber()
unitPrice: number
@ApiProperty()
@IsNumber()
discount: number
@ApiProperty()
@IsNumber()
quantity: number
}
export class NewItemDto {
@IsNumber()
@ApiProperty()
productId: number;
@ApiProperty()
@IsArray()
attributesValues: string[]
@ApiProperty()
@IsNumber()
quantity: number
@ApiProperty()
@IsNumber()
unitPrice: number
@ApiProperty()
@IsNumber()
discount: number
}
export class UpdateOrderDto {
@IsArray()
@ApiProperty({
isArray: true, type: [ItemDto], example: [
{
orderItemId: 1,
unitPrice: 100,
}
]
})
@IsNotEmpty()
@ArrayMinSize(1, { message: 'At least one product is required' })
@Type(() => ItemDto)
items: ItemDto[];
@IsArray()
@ApiProperty({
isArray: true, type: [ItemDto], example: [
{
orderItemId: 1,
unitPrice: 100,
}
]
})
@Type(() => NewItemDto)
newItems: NewItemDto[];
@ApiProperty()
@IsBoolean()
enableTax: boolean
@ApiPropertyOptional({ example: [] })
@IsArray()
@IsString({ each: true })
attachments: string[]
}