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
@@ -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 InvoiceOrderItemDto {
@IsNumber()
@ApiProperty()
orderItemId: number;
@ApiProperty()
@IsNumber()
unitPrice: number
@ApiProperty()
@IsNumber()
discount: number
@ApiProperty()
@IsNumber()
quantity: number
}
export class InvoiceOrderNewItemDto {
@IsNumber()
@ApiProperty()
productId: number;
@ApiProperty()
@IsArray()
attributesValues: string[]
@ApiProperty()
@IsNumber()
quantity: number
@ApiProperty()
@IsNumber()
unitPrice: number
@ApiProperty()
@IsNumber()
discount: number
}
export class UpdateInvoicedOrderDto {
@IsArray()
@ApiProperty({
isArray: true, type: [InvoiceOrderItemDto], example: [
{
orderItemId: 1,
unitPrice: 100,
}
]
})
@IsNotEmpty()
@ArrayMinSize(1, { message: 'At least one product is required' })
@Type(() => InvoiceOrderItemDto)
items: InvoiceOrderItemDto[];
@IsArray()
@ApiProperty({
isArray: true, type: [InvoiceOrderNewItemDto], example: [
{
orderItemId: 1,
unitPrice: 100,
}
]
})
@Type(() => InvoiceOrderNewItemDto)
newItems: InvoiceOrderNewItemDto[];
@ApiProperty()
@IsBoolean()
enableTax: boolean
@ApiPropertyOptional({ example: [] })
@IsArray()
@IsString({ each: true })
attachments: string[]
}
@@ -27,30 +27,9 @@ export class ItemDto {
}
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 {
export class UpdateOrderDtoAsUser {
@IsArray()
@ApiProperty({
isArray: true, type: [ItemDto], example: [
@@ -65,17 +44,6 @@ export class UpdateOrderDto {
@Type(() => ItemDto)
items: ItemDto[];
@IsArray()
@ApiProperty({
isArray: true, type: [ItemDto], example: [
{
orderItemId: 1,
unitPrice: 100,
}
]
})
@Type(() => NewItemDto)
newItems: NewItemDto[];
@ApiProperty()
@IsBoolean()
@@ -1,10 +0,0 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString } from 'class-validator';
export class UpdateOrderStatusDto {
@ApiPropertyOptional({
description: 'Change Status description',
})
@IsOptional()
@IsString()
desc?: string;
}