🔄 cleanup: order with 3 key relations, and ckflow now upto speeded
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { CheckoutStep } from "../../order/data/enums";
|
||||
import {
|
||||
CustomerInfo,
|
||||
customerInfoModel,
|
||||
@@ -7,7 +8,7 @@ import {
|
||||
PaymentDetailsPayload,
|
||||
paymentDetailsPayloadModel,
|
||||
} from "../../paymentinfo/data/entities";
|
||||
import { CheckoutStep } from "../../ticket/data/entities";
|
||||
import { productModel } from "../../product/data";
|
||||
|
||||
// Define action types for the checkout flow
|
||||
export enum CKActionType {
|
||||
@@ -57,24 +58,6 @@ export type PendingAction = z.infer<typeof pendingActionModel>;
|
||||
export const pendingActionsModel = z.array(pendingActionModel);
|
||||
export type PendingActions = z.infer<typeof pendingActionsModel>;
|
||||
|
||||
export const ticketSummaryModel = z.object({
|
||||
id: z.number().optional(),
|
||||
ticketId: z.string().optional(),
|
||||
departure: z.string(),
|
||||
arrival: z.string(),
|
||||
departureDate: z.string(),
|
||||
returnDate: z.string().optional(),
|
||||
flightType: z.string(),
|
||||
cabinClass: z.string(),
|
||||
priceDetails: z.object({
|
||||
currency: z.string(),
|
||||
displayPrice: z.number(),
|
||||
basePrice: z.number().optional(),
|
||||
discountAmount: z.number().optional(),
|
||||
}),
|
||||
});
|
||||
export type TicketSummary = z.infer<typeof ticketSummaryModel>;
|
||||
|
||||
// Core flow information model - what's actually stored in Redis
|
||||
export const flowInfoModel = z.object({
|
||||
id: z.coerce.number().optional(),
|
||||
@@ -87,8 +70,8 @@ export const flowInfoModel = z.object({
|
||||
isActive: z.boolean().default(true),
|
||||
lastSyncedAt: z.string().datetime(),
|
||||
|
||||
ticketInfo: ticketSummaryModel.optional(),
|
||||
ticketId: z.number().nullable().optional(),
|
||||
productInfo: productModel.optional(),
|
||||
productId: z.number().nullable().optional(),
|
||||
|
||||
personalInfoLastSyncedAt: z.string().datetime().optional(),
|
||||
paymentInfoLastSyncedAt: z.string().datetime().optional(),
|
||||
@@ -119,7 +102,7 @@ export type FlowInfo = z.infer<typeof flowInfoModel>;
|
||||
export const feCreateCheckoutFlowPayloadModel = z.object({
|
||||
domain: z.string(),
|
||||
refOIds: z.array(z.number()),
|
||||
ticketId: z.number().optional(),
|
||||
productId: z.number().optional(),
|
||||
});
|
||||
export type FECreateCheckoutFlowPayload = z.infer<
|
||||
typeof feCreateCheckoutFlowPayloadModel
|
||||
@@ -130,7 +113,7 @@ export const createCheckoutFlowPayloadModel = z.object({
|
||||
flowId: z.string(),
|
||||
domain: z.string(),
|
||||
refOIds: z.array(z.number()),
|
||||
ticketId: z.number().optional(),
|
||||
productId: z.number().optional(),
|
||||
ipAddress: z.string().default(""),
|
||||
userAgent: z.string().default(""),
|
||||
initialUrl: z.string().default(""),
|
||||
|
||||
8
packages/logic/domains/order/data/enums.ts
Normal file
8
packages/logic/domains/order/data/enums.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export enum CheckoutStep {
|
||||
Setup = "SETUP",
|
||||
Initial = "INITIAL",
|
||||
Payment = "PAYMENT",
|
||||
Verification = "VERIFICATION",
|
||||
Confirmation = "CONFIRMATION",
|
||||
Complete = "COMPLETE",
|
||||
}
|
||||
Reference in New Issue
Block a user