|
|
@@ -2,6 +2,31 @@ import { z } from 'zod';
|
|
|
import { DisabledStatus } from '@/share/types';
|
|
|
import { ActivityType } from './activity.entity';
|
|
|
|
|
|
+// 地点信息Schema
|
|
|
+const locationInfoSchema = z.object({
|
|
|
+ id: z.number().int().positive('地点ID必须为正整数'),
|
|
|
+ name: z.string().min(1, '地点名称不能为空'),
|
|
|
+ address: z.string().optional().nullable(),
|
|
|
+ province: z.object({
|
|
|
+ id: z.number().int().positive('省份ID必须为正整数'),
|
|
|
+ name: z.string().min(1, '省份名称不能为空'),
|
|
|
+ level: z.number().int().min(1).max(3),
|
|
|
+ code: z.string().optional().nullable(),
|
|
|
+ }).optional().nullable(),
|
|
|
+ city: z.object({
|
|
|
+ id: z.number().int().positive('城市ID必须为正整数'),
|
|
|
+ name: z.string().min(1, '城市名称不能为空'),
|
|
|
+ level: z.number().int().min(1).max(3),
|
|
|
+ code: z.string().optional().nullable(),
|
|
|
+ }).optional().nullable(),
|
|
|
+ district: z.object({
|
|
|
+ id: z.number().int().positive('区县ID必须为正整数'),
|
|
|
+ name: z.string().min(1, '区县名称不能为空'),
|
|
|
+ level: z.number().int().min(1).max(3),
|
|
|
+ code: z.string().optional().nullable(),
|
|
|
+ }).optional().nullable(),
|
|
|
+});
|
|
|
+
|
|
|
// 活动创建Schema
|
|
|
export const createActivitySchema = z.object({
|
|
|
name: z.string().min(1, '活动名称不能为空').max(255, '活动名称不能超过255个字符'),
|
|
|
@@ -49,6 +74,7 @@ export const getActivitySchema = z.object({
|
|
|
startDate: z.coerce.date(),
|
|
|
endDate: z.coerce.date(),
|
|
|
venueLocationId: z.number().int().positive('举办地点ID必须为正整数'),
|
|
|
+ venueLocation: locationInfoSchema.optional().nullable(),
|
|
|
isDisabled: z.nativeEnum(DisabledStatus),
|
|
|
createdAt: z.coerce.date(),
|
|
|
updatedAt: z.coerce.date(),
|
|
|
@@ -78,6 +104,7 @@ export const activityListResponseSchema = z.object({
|
|
|
startDate: z.coerce.date(),
|
|
|
endDate: z.coerce.date(),
|
|
|
venueLocationId: z.number().int().positive('举办地点ID必须为正整数'),
|
|
|
+ venueLocation: locationInfoSchema.optional().nullable(),
|
|
|
isDisabled: z.nativeEnum(DisabledStatus),
|
|
|
createdAt: z.coerce.date(),
|
|
|
updatedAt: z.coerce.date(),
|