create invoice

This commit is contained in:
2026-01-17 19:25:32 +03:30
parent 02ab8fbc6a
commit d6d371b13a
5 changed files with 112 additions and 13 deletions
@@ -0,0 +1,40 @@
import {
IsInt, IsArray, IsNumber,
IsNotEmpty,
ArrayMinSize
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
export class InvoiceItemDto {
@IsInt()
@ApiProperty()
orderItemId: bigint;
@ApiProperty()
@IsNumber()
unitPrice: number
}
export class CreateInvoiceDto {
@IsArray()
@ApiProperty({
isArray: true, type: [InvoiceItemDto], example: [
{
productId: 1,
quantity: 100,
attributesValues: []
}
]
})
@IsNotEmpty()
@ArrayMinSize(1, { message: 'At least one product is required' })
@Type(() => InvoiceItemDto)
items: InvoiceItemDto[];
@ApiProperty()
@IsNumber()
discount: number
}