| 1 | import { AccountType, createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | |
| 4 | const OptionalHttpUrlSchema = z.preprocess( |
| 5 | value => value === '' ? undefined : value, |
| 6 | z.httpUrl().optional(), |
| 7 | ) |
| 8 | |
| 9 | const RelayCallbackDtoSchema = z.object({ |
| 10 | relayAccountRef: z.string().min(1).describe('官方服务器上的账号 ID'), |
| 11 | nickname: z.string().describe('账号昵称'), |
| 12 | avatar: z.string().optional().describe('账号头像'), |
| 13 | platformUid: z.string().min(1).describe('平台用户 ID'), |
| 14 | platform: z.enum(AccountType).describe('平台类型'), |
| 15 | taskId: z.string().optional().describe('授权任务 ID'), |
| 16 | redirectUri: OptionalHttpUrlSchema.describe('授权完成后浏览器跳转地址'), |
| 17 | accounts: z.string().optional().describe('多账号回调 JSON'), |
| 18 | }) |
| 19 | export class RelayCallbackDto extends createZodDto(RelayCallbackDtoSchema, 'RelayCallbackDto') {} |
| 20 |