order update refactor
This commit is contained in:
@@ -5,7 +5,8 @@ import {
|
||||
ArrayMinSize,
|
||||
IsOptional,
|
||||
IsBoolean,
|
||||
IsEnum
|
||||
IsEnum,
|
||||
IsDateString
|
||||
} from 'class-validator';
|
||||
import { ApiPropertyOptional, ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
@@ -57,6 +58,14 @@ export class CreateOrderItemDtoAsAdmin extends CreateOrderItemAsUserDto {
|
||||
@IsNumber()
|
||||
discount: number
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsString()
|
||||
adminDescription: string
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsDateString()
|
||||
confirmedAt: string
|
||||
|
||||
}
|
||||
|
||||
export class CreateOrderAsUSerDto {
|
||||
@@ -102,8 +111,8 @@ export class CreateOrderAsAdminDto {
|
||||
// printAttachments: [{ url: '', type: '' }],
|
||||
quantity: 100,
|
||||
attributes: [],
|
||||
unitPrice:150000,
|
||||
discount:20000
|
||||
unitPrice: 150000,
|
||||
discount: 20000
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
import { OmitType, PartialType } from '@nestjs/swagger';
|
||||
import { CreateOrderAsAdminDto } from './create-order.dto';
|
||||
import { ApiProperty, OmitType, PartialType } from '@nestjs/swagger';
|
||||
import { CreateOrderAsAdminDto, CreateOrderItemDtoAsAdmin } from './create-order.dto';
|
||||
import { IsNumber } from 'class-validator';
|
||||
|
||||
export class UpdateOrderAsAdminDto extends PartialType(OmitType(CreateOrderAsAdminDto, 'items' as any)) { }
|
||||
export class UpdateOrderAsAdminDto extends PartialType(OmitType(CreateOrderAsAdminDto, 'items' as any)) {
|
||||
@ApiProperty()
|
||||
items: UpdateOrCreateOrderItem[]
|
||||
}
|
||||
|
||||
export class UpdateOrCreateOrderItem extends CreateOrderItemDtoAsAdmin {
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
id: number
|
||||
}
|
||||
Reference in New Issue
Block a user