| 1 | import { AccountType, createZodDto } from '@yikart/common' |
| 2 | import { AccountStatus } from '@yikart/mongodb' |
| 3 | import { z } from 'zod' |
| 4 | |
| 5 | export const ChannelAccountCreateSchema = z.object({ |
| 6 | type: z.enum(AccountType).describe('平台类型'), |
| 7 | uid: z.string().min(1).optional().describe('平台账号 UID,不传时由平台登录凭据获取'), |
| 8 | nickname: z.string().min(1).optional().describe('昵称,不传时由平台登录凭据获取'), |
| 9 | avatar: z.string().optional().describe('头像 URL'), |
| 10 | groupId: z.string().optional().describe('账号分组 ID'), |
| 11 | loginCookie: z.string().min(1).optional().describe('平台登录 Cookie'), |
| 12 | }) |
| 13 | |
| 14 | export class ChannelAccountCreateDto extends createZodDto(ChannelAccountCreateSchema) {} |
| 15 | |
| 16 | export const ChannelAccountListQuerySchema = z.object({ |
| 17 | ids: z.array(z.string().min(1)).optional().describe('账号 ID 数组'), |
| 18 | spaceIds: z.array(z.string().min(1)).optional().describe('空间/分组 ID 数组'), |
| 19 | types: z.array(z.enum(AccountType)).optional().describe('平台类型数组'), |
| 20 | status: z.coerce.number().pipe(z.enum(AccountStatus)).optional().describe('账号状态'), |
| 21 | groupId: z.string().optional().describe('账号分组 ID'), |
| 22 | }) |
| 23 | |
| 24 | export class ChannelAccountListQueryDto extends createZodDto(ChannelAccountListQuerySchema) {} |
| 25 | |
| 26 | export const ChannelAccountDeleteQuerySchema = z.object({ |
| 27 | ids: z.array(z.string().min(1)).min(1).describe('账号 ID 数组'), |
| 28 | }) |
| 29 | |
| 30 | export class ChannelAccountDeleteQueryDto extends createZodDto(ChannelAccountDeleteQuerySchema) {} |
| 31 | |
| 32 | export const ChannelAccountAnalyticsQuerySchema = z.object({ |
| 33 | since: z.coerce.date().optional().describe('开始时间'), |
| 34 | until: z.coerce.date().optional().describe('结束时间'), |
| 35 | }) |
| 36 | |
| 37 | export class ChannelAccountAnalyticsQueryDto extends createZodDto(ChannelAccountAnalyticsQuerySchema) {} |
| 38 |