| 1 | import { createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | |
| 4 | const ChannelAccountGroupOutputSchema = z.object({ |
| 5 | id: z.string().describe('分组 ID'), |
| 6 | name: z.string().describe('分组名称'), |
| 7 | rank: z.number().optional().describe('排序值'), |
| 8 | ip: z.string().optional().describe('IP'), |
| 9 | location: z.string().optional().describe('位置'), |
| 10 | countryCode: z.string().optional().describe('国家代码'), |
| 11 | proxyIp: z.string().optional().describe('代理 IP'), |
| 12 | isDefault: z.boolean().optional().describe('是否默认分组'), |
| 13 | hasBrowserConfig: z.boolean().describe('是否包含浏览器指纹配置'), |
| 14 | createdAt: z.coerce.date().optional().describe('创建时间'), |
| 15 | updatedAt: z.coerce.date().optional().describe('更新时间'), |
| 16 | }) |
| 17 | |
| 18 | export const ChannelAccountGroupVoSchema = z.preprocess((input) => { |
| 19 | if (!input || typeof input !== 'object') { |
| 20 | return input |
| 21 | } |
| 22 | |
| 23 | const group = input as { browserConfig?: unknown, hasBrowserConfig?: unknown } |
| 24 | return { |
| 25 | ...group, |
| 26 | hasBrowserConfig: typeof group.hasBrowserConfig === 'boolean' |
| 27 | ? group.hasBrowserConfig |
| 28 | : Boolean(group.browserConfig), |
| 29 | } |
| 30 | }, ChannelAccountGroupOutputSchema) |
| 31 | |
| 32 | export class ChannelAccountGroupVo extends createZodDto(ChannelAccountGroupVoSchema, 'ChannelAccountGroupVo') {} |
| 33 |