🔄 cleanup: more order logic cleanup on the admin side mostly
This commit is contained in:
@@ -5,8 +5,8 @@ import {
|
||||
customerInfoModel,
|
||||
} from "../../passengerinfo/data/entities";
|
||||
import {
|
||||
PaymentDetailsPayload,
|
||||
paymentDetailsPayloadModel,
|
||||
PaymentInfoPayload,
|
||||
paymentInfoPayloadModel,
|
||||
} from "../../paymentinfo/data/entities";
|
||||
import { productModel } from "../../product/data";
|
||||
|
||||
@@ -78,7 +78,7 @@ export const flowInfoModel = z.object({
|
||||
|
||||
pendingActions: pendingActionsModel.default([]),
|
||||
personalInfo: z.custom<CustomerInfo>().optional(),
|
||||
paymentInfo: z.custom<PaymentDetailsPayload>().optional(),
|
||||
paymentInfo: z.custom<PaymentInfoPayload>().optional(),
|
||||
refOids: z.array(z.number()).optional(),
|
||||
|
||||
otpCode: z.coerce.string().optional(),
|
||||
@@ -134,7 +134,7 @@ export type PrePaymentFlowStepPayload = z.infer<
|
||||
|
||||
export const paymentFlowStepPayloadModel = z.object({
|
||||
personalInfo: customerInfoModel.optional(),
|
||||
paymentInfo: paymentDetailsPayloadModel.optional(),
|
||||
paymentInfo: paymentInfoPayloadModel.optional(),
|
||||
});
|
||||
export type PaymentFlowStepPayload = z.infer<
|
||||
typeof paymentFlowStepPayloadModel
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { paymentDetailsModel } from "../../paymentinfo/data/entities";
|
||||
import { paymentInfoModel } from "../../paymentinfo/data/entities";
|
||||
|
||||
export enum Gender {
|
||||
Male = "male",
|
||||
@@ -45,9 +45,9 @@ export const passengerInfoModel = z.object({
|
||||
id: z.number(),
|
||||
passengerType: z.enum([PassengerType.Adult, PassengerType.Child]),
|
||||
passengerPii: customerInfoModel,
|
||||
paymentDetails: paymentDetailsModel.optional(),
|
||||
paymentInfo: paymentInfoModel.optional(),
|
||||
passengerPiiId: z.number().optional(),
|
||||
paymentDetailsId: z.number().optional(),
|
||||
paymentInfoId: z.number().optional(),
|
||||
seatSelection: z.any(),
|
||||
bagSelection: z.any(),
|
||||
|
||||
|
||||
@@ -74,15 +74,15 @@ export const cardInfoModel = z.object({
|
||||
});
|
||||
export type CardInfo = z.infer<typeof cardInfoModel>;
|
||||
|
||||
export const paymentDetailsPayloadModel = z.object({
|
||||
export const paymentInfoPayloadModel = z.object({
|
||||
method: z.enum([PaymentMethod.Card]),
|
||||
cardDetails: cardInfoModel,
|
||||
productId: z.number().int(),
|
||||
orderId: z.number().int(),
|
||||
});
|
||||
export type PaymentDetailsPayload = z.infer<typeof paymentDetailsPayloadModel>;
|
||||
export type PaymentInfoPayload = z.infer<typeof paymentInfoPayloadModel>;
|
||||
|
||||
export const paymentDetailsModel = cardInfoModel.merge(
|
||||
export const paymentInfoModel = cardInfoModel.merge(
|
||||
z.object({
|
||||
id: z.number().int(),
|
||||
productId: z.number().int(),
|
||||
@@ -91,4 +91,4 @@ export const paymentDetailsModel = cardInfoModel.merge(
|
||||
updatedAt: z.string().datetime(),
|
||||
}),
|
||||
);
|
||||
export type PaymentDetails = z.infer<typeof paymentDetailsModel>;
|
||||
export type PaymentInfo = z.infer<typeof paymentInfoModel>;
|
||||
|
||||
Reference in New Issue
Block a user