clean order services
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { Product } from "src/modules/product/entities/product.entity"
|
||||
import { Order } from "../entities/order.entity"
|
||||
|
||||
export enum OrderStatusEnum {
|
||||
CREATED = 'created',
|
||||
|
||||
@@ -26,21 +29,27 @@ export enum OrderStatusEnum {
|
||||
}
|
||||
|
||||
|
||||
export interface IAddOrderItem {
|
||||
productId: bigint;
|
||||
export interface CreateOrderItemParam{
|
||||
quantity: number
|
||||
attributes: IAttribute[]
|
||||
description: string
|
||||
attachments: { url: string, type: string }[]
|
||||
attributes?: IAttribute[]
|
||||
description?: string
|
||||
attachments?: { url: string, type: string }[]
|
||||
unitPrice?: number
|
||||
discount?: number
|
||||
}
|
||||
|
||||
export type IUpdateOrderItem = Partial<IAddOrderItem>
|
||||
|
||||
export interface ICreateOrder {
|
||||
export interface CreateOrderParam {
|
||||
userId: string
|
||||
items: IAddOrderItem[];
|
||||
items: Array<{
|
||||
productId: number,
|
||||
quantity: number
|
||||
attributes: IAttribute[]
|
||||
description: string
|
||||
attachments: { url: string, type: string }[]
|
||||
unitPrice?: number
|
||||
discount?: number
|
||||
}>;
|
||||
status: OrderStatusEnum
|
||||
//optional
|
||||
enableTax?: Boolean
|
||||
@@ -51,6 +60,17 @@ export interface ICreateOrder {
|
||||
designerId?: string
|
||||
}
|
||||
|
||||
export type IUpdateOrder = Partial<Omit<ICreateOrder, 'items'>>
|
||||
export type UpdateOrderParam = Partial<Omit<CreateOrderParam, 'items'>>
|
||||
|
||||
|
||||
export interface UpdateOrderItem {
|
||||
productId?: number,
|
||||
quantity?: number
|
||||
attributes?: IAttribute[]
|
||||
description?: string
|
||||
attachments?: { url: string, type: string }[]
|
||||
unitPrice?: number
|
||||
discount?: number
|
||||
}
|
||||
|
||||
export interface IAttribute { attributeId: number, value: string | number | boolean }
|
||||
Reference in New Issue
Block a user