a.... LOT of Refactoring ~ 30% done???
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import { CustomerInfoModel, customerInfoModel } from "../../customerinfo/data";
|
||||
import { CheckoutStep } from "../../order/data/enums";
|
||||
import {
|
||||
CustomerInfo,
|
||||
customerInfoModel,
|
||||
} from "../../passengerinfo/data/entities";
|
||||
import {
|
||||
PaymentInfoPayload,
|
||||
paymentInfoPayloadModel,
|
||||
@@ -77,7 +74,7 @@ export const flowInfoModel = z.object({
|
||||
paymentInfoLastSyncedAt: z.string().datetime().optional(),
|
||||
|
||||
pendingActions: pendingActionsModel.default([]),
|
||||
personalInfo: z.custom<CustomerInfo>().optional(),
|
||||
personalInfo: z.custom<CustomerInfoModel>().optional(),
|
||||
paymentInfo: z.custom<PaymentInfoPayload>().optional(),
|
||||
refOids: z.array(z.number()).optional(),
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export enum Gender {
|
||||
Male = "male",
|
||||
Female = "female",
|
||||
Other = "other",
|
||||
}
|
||||
|
||||
export const customerInfoModel = z.object({
|
||||
id: z.number().optional(),
|
||||
firstName: z.string().min(1).max(64),
|
||||
|
||||
@@ -21,14 +21,20 @@ export enum OrderStatus {
|
||||
CANCELLED = "CANCELLED",
|
||||
}
|
||||
|
||||
export const orderModel = z.object({
|
||||
id: z.coerce.number().int().positive(),
|
||||
|
||||
export const orderPriceDetailsModel = z.object({
|
||||
currency: z.string(),
|
||||
discountAmount: z.coerce.number().min(0),
|
||||
basePrice: z.coerce.number().min(0),
|
||||
displayPrice: z.coerce.number().min(0),
|
||||
orderPrice: z.coerce.number().min(0),
|
||||
fullfilledPrice: z.coerce.number().min(0),
|
||||
});
|
||||
export type OrderPriceDetailsModel = z.infer<typeof orderPriceDetailsModel>;
|
||||
|
||||
export const orderModel = z.object({
|
||||
id: z.coerce.number().int().positive(),
|
||||
|
||||
...orderPriceDetailsModel.shape,
|
||||
|
||||
status: z.nativeEnum(OrderStatus),
|
||||
|
||||
@@ -119,5 +125,6 @@ export const createOrderPayloadModel = z.object({
|
||||
customerInfo: customerInfoModel,
|
||||
paymentInfo: paymentInfoPayloadModel.optional(),
|
||||
orderModel: newOrderModel,
|
||||
flowId: z.string().optional(),
|
||||
});
|
||||
export type CreateOrderModel = z.infer<typeof createOrderPayloadModel>;
|
||||
|
||||
Reference in New Issue
Block a user