update order

This commit is contained in:
2026-01-30 21:01:20 +03:30
parent fde120da3c
commit 5e5eeec5be
12 changed files with 189 additions and 256 deletions
+33 -35
View File
@@ -1,3 +1,6 @@
import { Admin } from "src/modules/admin/entities/admin.entity"
import { Product } from "src/modules/product/entities/product.entity"
export enum OrderStatusEnum {
CREATED = 'created',
@@ -25,49 +28,44 @@ export enum OrderStatusEnum {
CANCELED = 'canceled',
}
export interface IField { fieldId: number, value: string }
export interface CreateOrderItemParam{
export interface IAttachment { type: string, url: string }
export interface CreateOrderItem {
productId: number,
quantity: number
attributes?: IAttribute[]
attributes?: IField[]
description?: string
attachments?: { url: string, type: string }[]
attachments?: IAttachment[]
unitPrice?: number
discount?: number
}
export interface CreateOrderParam {
userId: string
items: Array<{
productId: number,
quantity: number
attributes: IAttribute[]
description: string
attachments: { url: string, type: string }[]
unitPrice?: number
discount?: number
}>;
status: OrderStatusEnum
//optional
enableTax?: Boolean
attachments?: string[]
paymentMethod?: string
adminId?: string
estimatedDays?: number
print?: IField[]
printAttachments?: IAttachment[]
designerId?: string
}
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 type CreateOrderItemPopulated = Omit<CreateOrderItem, 'productId' | 'designerId'> & {
product: Product,
designer?: Admin
}
export interface IAttribute { attributeId: number, value: string | number | boolean }
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>