🔄 cleanup: more order logic cleanup on the admin side mostly

This commit is contained in:
user
2025-10-20 22:39:00 +03:00
parent 10bcbf982a
commit 4ae1957a88
18 changed files with 375 additions and 221 deletions

View File

@@ -2,7 +2,7 @@ import { z } from "zod";
import { paginationModel } from "../../../core/pagination.utils";
import { encodeCursor } from "../../../core/string.utils";
import { customerInfoModel } from "../../customerinfo/data";
import { paymentDetailsPayloadModel } from "../../paymentinfo/data/entities";
import { paymentInfoPayloadModel } from "../../paymentinfo/data/entities";
import { productModel } from "../../product/data";
export enum OrderCreationStep {
@@ -35,7 +35,7 @@ export const orderModel = z.object({
productId: z.number(),
customerInfoId: z.number().nullish().optional(),
emailAccountId: z.number().nullish().optional(),
paymentDetailsId: z.number().nullish().optional(),
paymentInfoId: z.number().nullish().optional(),
createdAt: z.coerce.string(),
updatedAt: z.coerce.string(),
@@ -108,7 +108,7 @@ export const newOrderModel = orderModel.pick({
fullfilledPrice: true,
productId: true,
customerInfoId: true,
paymentDetailsId: true,
paymentInfoId: true,
emailAccountId: true,
});
export type NewOrderModel = z.infer<typeof newOrderModel>;
@@ -117,7 +117,7 @@ export const createOrderPayloadModel = z.object({
product: productModel.optional(),
productId: z.number().optional(),
customerInfo: customerInfoModel,
paymentDetails: paymentDetailsPayloadModel.optional(),
paymentInfo: paymentInfoPayloadModel.optional(),
orderModel: newOrderModel,
});
export type CreateOrderModel = z.infer<typeof createOrderPayloadModel>;