add item to invoice
This commit is contained in:
@@ -2,9 +2,10 @@ import {
|
||||
IsInt, IsArray, IsNumber,
|
||||
IsNotEmpty,
|
||||
ArrayMinSize,
|
||||
IsBoolean
|
||||
IsBoolean,
|
||||
IsString
|
||||
} from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class InvoiceItemDto {
|
||||
@@ -20,6 +21,33 @@ export class InvoiceItemDto {
|
||||
@IsNumber()
|
||||
discount: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
}
|
||||
|
||||
export class InvoiceNewItemDto {
|
||||
@IsNumber()
|
||||
@ApiProperty()
|
||||
productId: number;
|
||||
|
||||
@ApiProperty()
|
||||
@IsArray()
|
||||
attributesValues: string[]
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
quantity: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
unitPrice: number
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
discount: number
|
||||
|
||||
}
|
||||
|
||||
export class CreateInvoiceDto {
|
||||
@@ -37,9 +65,27 @@ export class CreateInvoiceDto {
|
||||
@Type(() => InvoiceItemDto)
|
||||
items: InvoiceItemDto[];
|
||||
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
isArray: true, type: [InvoiceItemDto], example: [
|
||||
{
|
||||
orderItemId: 1,
|
||||
unitPrice: 100,
|
||||
}
|
||||
]
|
||||
})
|
||||
@Type(() => InvoiceNewItemDto)
|
||||
newItems: InvoiceNewItemDto[];
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
enableTax: boolean
|
||||
|
||||
|
||||
@ApiPropertyOptional({ example: [] })
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
attachments: string[]
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user