product
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
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[]
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
// import { PartialType } from '@nestjs/swagger';
|
||||
// import { CreateOrderDto } from './create-order.dto';
|
||||
|
||||
// export class UpdateOrderDto extends PartialType(CreateOrderDto) {}
|
||||
export class UpdateOrderDto {}
|
||||
|
||||
Reference in New Issue
Block a user