| 1 | import { createZodDto } from '@yikart/common' |
| 2 | import { UserType } from '@yikart/mongodb' |
| 3 | /* |
| 4 | * @Author: nevin |
| 5 | * @Date: 2024-06-17 20:12:31 |
| 6 | * @LastEditTime: 2025-05-06 15:49:03 |
| 7 | * @LastEditors: nevin |
| 8 | * @Description: 用户 |
| 9 | */ |
| 10 | import { z } from 'zod' |
| 11 | |
| 12 | const UpdateUserInfoSchema = z.object({ |
| 13 | name: z.string({ message: '昵称' }).optional(), |
| 14 | avatar: z.string({ message: '头像' }).optional(), |
| 15 | }) |
| 16 | |
| 17 | export class UpdateUserInfoDto extends createZodDto(UpdateUserInfoSchema) {} |
| 18 | |
| 19 | export const SetAiConfigSchema = z.object({ |
| 20 | image: z.object({ |
| 21 | defaultModel: z.string(), |
| 22 | option: z.record(z.string(), z.any()).optional(), |
| 23 | }), |
| 24 | edit: z.object({ |
| 25 | defaultModel: z.string(), |
| 26 | option: z.record(z.string(), z.any()).optional(), |
| 27 | }), |
| 28 | video: z.object({ |
| 29 | defaultModel: z.string(), |
| 30 | option: z.record(z.string(), z.any()).optional(), |
| 31 | }), |
| 32 | agent: z.object({ |
| 33 | defaultModel: z.string(), |
| 34 | option: z.record(z.string(), z.any()).optional(), |
| 35 | }), |
| 36 | }) |
| 37 | export class SetAiConfigDto extends createZodDto(SetAiConfigSchema) {} |
| 38 | |
| 39 | export const SetAiConfigItemSchema = z.object({ |
| 40 | type: z.enum(['image', 'edit', 'video', 'agent']), |
| 41 | value: z.object({ |
| 42 | defaultModel: z.string(), |
| 43 | option: z.record(z.string(), z.any()).optional(), |
| 44 | }), |
| 45 | }) |
| 46 | export class SetAiConfigItemDto extends createZodDto(SetAiConfigItemSchema) {} |
| 47 | |
| 48 | export const ReportLocationDtoSchema = z.object({ |
| 49 | lat: z.number().describe('纬度'), |
| 50 | lng: z.number().describe('经度'), |
| 51 | country: z.string().optional().describe('国家名称'), |
| 52 | countryCode: z.string().optional().describe('国家代码'), |
| 53 | city: z.string().optional().describe('城市名称'), |
| 54 | cityCode: z.string().optional().describe('城市代码'), |
| 55 | district: z.string().optional().describe('区/县名称'), |
| 56 | districtCode: z.string().optional().describe('区/县代码'), |
| 57 | }) |
| 58 | export class ReportLocationDto extends createZodDto(ReportLocationDtoSchema, 'ReportLocationDto') {} |
| 59 | |
| 60 | export const UpdateLocaleDtoSchema = z.object({ |
| 61 | locale: z |
| 62 | .enum(['en-US', 'zh-CN']) |
| 63 | .describe('语言偏好'), |
| 64 | }) |
| 65 | export class UpdateLocaleDto extends createZodDto( |
| 66 | UpdateLocaleDtoSchema, |
| 67 | 'UpdateLocaleDto', |
| 68 | ) {} |
| 69 | |
| 70 | export const SwitchUserTypeDtoSchema = z.object({ |
| 71 | userType: z |
| 72 | .enum([UserType.CREATOR, UserType.BUSINESS_OWNER]) |
| 73 | .describe('目标用户类型'), |
| 74 | }) |
| 75 | export class SwitchUserTypeDto extends createZodDto( |
| 76 | SwitchUserTypeDtoSchema, |
| 77 | 'SwitchUserTypeDto', |
| 78 | ) {} |
| 79 |