big boi refactor to customer inof from passenger info
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
import { z } from "zod";
|
||||
import { paginationModel } from "../../../core/pagination.utils";
|
||||
import { encodeCursor } from "../../../core/string.utils";
|
||||
import {
|
||||
emailAccountModel,
|
||||
emailAccountPayloadModel,
|
||||
} from "../../account/data/entities";
|
||||
import { flightTicketModel } from "../../ticket/data/entities";
|
||||
import { passengerInfoModel } from "../../passengerinfo/data/entities";
|
||||
import { z } from "zod";
|
||||
import { customerInfoModel } from "../../customerinfo/data";
|
||||
import { paymentDetailsPayloadModel } from "../../paymentinfo/data/entities";
|
||||
import { flightTicketModel } from "../../ticket/data/entities";
|
||||
|
||||
export enum OrderCreationStep {
|
||||
ACCOUNT_SELECTION = 0,
|
||||
TICKET_SELECTION = 1,
|
||||
PASSENGER_INFO = 2,
|
||||
CUSTOMER_INFO = 2,
|
||||
SUMMARY = 3,
|
||||
}
|
||||
|
||||
@@ -31,7 +27,7 @@ export const orderModel = z.object({
|
||||
displayPrice: z.coerce.number().min(0),
|
||||
orderPrice: z.coerce.number().min(0),
|
||||
fullfilledPrice: z.coerce.number().min(0),
|
||||
pricePerPassenger: z.coerce.number().min(0),
|
||||
pricePerCustomer: z.coerce.number().min(0),
|
||||
|
||||
status: z.nativeEnum(OrderStatus),
|
||||
|
||||
@@ -51,7 +47,7 @@ export const limitedOrderWithTicketInfoModel = orderModel
|
||||
basePrice: true,
|
||||
discountAmount: true,
|
||||
displayPrice: true,
|
||||
pricePerPassenger: true,
|
||||
pricePerCustomer: true,
|
||||
fullfilledPrice: true,
|
||||
status: true,
|
||||
})
|
||||
@@ -75,8 +71,7 @@ export type LimitedOrderWithTicketInfoModel = z.infer<
|
||||
export const fullOrderModel = orderModel.merge(
|
||||
z.object({
|
||||
flightTicketInfo: flightTicketModel,
|
||||
emailAccount: emailAccountModel.nullable().optional(),
|
||||
passengerInfos: z.array(passengerInfoModel).default([]),
|
||||
customerInfos: z.array(customerInfoModel).default([]),
|
||||
}),
|
||||
);
|
||||
export type FullOrderModel = z.infer<typeof fullOrderModel>;
|
||||
@@ -113,7 +108,7 @@ export const newOrderModel = orderModel.pick({
|
||||
discountAmount: true,
|
||||
orderPrice: true,
|
||||
fullfilledPrice: true,
|
||||
pricePerPassenger: true,
|
||||
pricePerCustomer: true,
|
||||
flightTicketInfoId: true,
|
||||
paymentDetailsId: true,
|
||||
emailAccountId: true,
|
||||
@@ -126,8 +121,7 @@ export const createOrderPayloadModel = z.object({
|
||||
refOIds: z.array(z.number()).nullable().optional(),
|
||||
paymentDetails: paymentDetailsPayloadModel.optional(),
|
||||
orderModel: newOrderModel,
|
||||
emailAccountInfo: emailAccountPayloadModel.optional(),
|
||||
passengerInfos: z.array(passengerInfoModel),
|
||||
customerInfos: z.array(customerInfoModel),
|
||||
flowId: z.string().optional(),
|
||||
});
|
||||
export type CreateOrderModel = z.infer<typeof createOrderPayloadModel>;
|
||||
|
||||
Reference in New Issue
Block a user