|
|
@@ -1,13 +1,27 @@
|
|
|
import { z } from 'zod';
|
|
|
import { OrderStatus, PaymentStatus } from '../../share/order.types';
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+// 路线快照Schema
|
|
|
+export const RouteSnapshotSchema = z.object({
|
|
|
+ id: z.number(),
|
|
|
+ name: z.string(),
|
|
|
+ pickupPoint: z.string(),
|
|
|
+ dropoffPoint: z.string(),
|
|
|
+ departureTime: z.coerce.date(),
|
|
|
+ price: z.coerce.number(),
|
|
|
+ vehicleType: z.string(),
|
|
|
+ travelMode: z.string()
|
|
|
+});
|
|
|
+
|
|
|
// 创建订单Schema
|
|
|
export const OrderCreateSchema = z.object({
|
|
|
routeId: z.number().int().positive(),
|
|
|
passengerCount: z.number().int().min(1),
|
|
|
totalAmount: z.number().positive(),
|
|
|
passengerSnapshots: z.array(z.any()),
|
|
|
- routeSnapshot: z.any(),
|
|
|
+ routeSnapshot: RouteSnapshotSchema,
|
|
|
createdBy: z.number().int().positive().optional()
|
|
|
});
|
|
|
|
|
|
@@ -32,18 +46,6 @@ export const OrderListSchema = z.object({
|
|
|
search: z.string().optional()
|
|
|
});
|
|
|
|
|
|
-// 路线快照Schema
|
|
|
-export const RouteSnapshotSchema = z.object({
|
|
|
- id: z.number(),
|
|
|
- name: z.string(),
|
|
|
- pickupPoint: z.string(),
|
|
|
- dropoffPoint: z.string(),
|
|
|
- departureTime: z.coerce.date(),
|
|
|
- price: z.number(),
|
|
|
- vehicleType: z.string(),
|
|
|
- travelMode: z.string()
|
|
|
-});
|
|
|
-
|
|
|
// 订单响应Schema
|
|
|
export const OrderResponseSchema = z.object({
|
|
|
id: z.number(),
|