72 lines
1.6 KiB
TypeScript
72 lines
1.6 KiB
TypeScript
import { Admin } from "src/modules/admin/entities/admin.entity"
|
|
import { Product } from "src/modules/product/entities/product.entity"
|
|
|
|
export enum OrderStatusEnum {
|
|
CREATED = 'created',
|
|
|
|
INVOICED = 'invoiced',
|
|
WAITING_to_CONFIRM_INVOICE = 'waiting_to_confirm_invoice',
|
|
|
|
|
|
DESIGN_INITIATED = 'design_initiated',
|
|
DESIGN_FINISHED = 'design_finished',
|
|
DESIGN_REVISION = 'design_revision',
|
|
|
|
READY_TO_PRINTING = 'ready_to_printing',
|
|
IN_PRINTING = 'in_printing',
|
|
|
|
READY_FOR_DELIVERY = 'ready_for_delivery',
|
|
DELIVERED = 'delivered',
|
|
|
|
AFTER_PRINT_COVER = 'after_print_cover',
|
|
AFTER_PRINT_BOXING = 'after_print_boxing',
|
|
AFTER_PRINT_CARTONING = 'after_print_cartoning',
|
|
|
|
|
|
FINISHED = 'finished',
|
|
|
|
CANCELED = 'canceled',
|
|
}
|
|
|
|
export interface IField { fieldId: number, value: string }
|
|
|
|
export interface IAttachment { type: string, url: string }
|
|
|
|
export interface CreateOrderItem {
|
|
productId: number,
|
|
quantity: number
|
|
attributes?: IField[]
|
|
description?: string
|
|
attachments?: IAttachment[]
|
|
unitPrice?: number
|
|
discount?: number
|
|
printFormCreatedAt?: Date
|
|
|
|
printAttributes?: IField[]
|
|
designerId?: string
|
|
}
|
|
|
|
export type CreateOrderItemPopulated = Omit<CreateOrderItem, 'productId' | 'designerId'> & {
|
|
product: Product,
|
|
designer?: Admin
|
|
}
|
|
|
|
export interface CreateOrder {
|
|
userId: string
|
|
status: OrderStatusEnum
|
|
enableTax?: Boolean
|
|
paymentMethod?: string
|
|
adminId?: string
|
|
estimatedDays?: number
|
|
}
|
|
|
|
export interface CreateOrderWithItems extends CreateOrder {
|
|
items: CreateOrderItem[]
|
|
}
|
|
|
|
export type UpdateOrder = Partial<CreateOrder>
|
|
|
|
|
|
export type UpdateOrderItem = Partial<CreateOrderItemPopulated>
|
|
|