clean order services

This commit is contained in:
2026-01-27 14:52:55 +03:30
parent 935f905e29
commit e2b065aa2b
9 changed files with 319 additions and 277 deletions
+29 -9
View File
@@ -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 }