feat: initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { Type } from 'class-transformer';
|
||||
import { ArrayMinSize, IsArray, IsInt, IsNumber, IsOptional, IsPositive, IsString, Min, ValidateNested } from 'class-validator';
|
||||
|
||||
export class CreateOrderItemInputDto {
|
||||
@IsString()
|
||||
productVariantId!: string;
|
||||
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
quantity!: number;
|
||||
|
||||
/** Making-charge percentage negotiated for this order (may differ from the variant default). */
|
||||
@IsNumber()
|
||||
wagePercent!: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
discountPercent?: number;
|
||||
|
||||
/** Flat Rial charge per unit, independent of gold weight (e.g. stones). */
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
flatRialCharge?: number;
|
||||
}
|
||||
|
||||
export class CreateOrderDto {
|
||||
@IsString()
|
||||
customerId!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
branchId?: string;
|
||||
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateOrderItemInputDto)
|
||||
items!: CreateOrderItemInputDto[];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { IsEnum, IsOptional, IsString } from 'class-validator';
|
||||
import { OrderStatus } from '@prisma/client';
|
||||
|
||||
export class UpdateOrderStatusDto {
|
||||
@IsEnum(OrderStatus)
|
||||
status!: OrderStatus;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
note?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
actorAdminUserId?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user