返回 AiToEarn
account.vo.ts
1 import { AccountType, createZodDto, FileUtil } from '@yikart/common'
2 import { AccountStatus, ClientType } from '@yikart/mongodb'
3 import { z } from 'zod'
4
5 export const ChannelAccountVoSchema = z.object({
6 id: z.string().describe('账号 ID'),
7 userId: z.string().describe('用户 ID'),
8 type: z.enum(AccountType).describe('平台'),
9 clientType: z.enum(ClientType).optional().describe('客户端类型'),
10 uid: z.string().describe('平台账号 UID'),
11 account: z.string().optional().describe('平台账号名'),
12 loginTime: z.coerce.date().optional().describe('登录时间'),
13 avatar: FileUtil.zodBuildUrl().optional().describe('头像 URL'),
14 nickname: z.string().describe('昵称'),
15 fansCount: z.number().optional().describe('粉丝数'),
16 followingCount: z.number().optional().describe('关注数'),
17 readCount: z.number().optional().describe('阅读数'),
18 likeCount: z.number().optional().describe('点赞数'),
19 collectCount: z.number().optional().describe('收藏数'),
20 forwardCount: z.number().optional().describe('转发数'),
21 commentCount: z.number().optional().describe('评论数'),
22 lastStatsTime: z.coerce.date().optional().describe('最近统计时间'),
23 workCount: z.number().optional().describe('作品数'),
24 income: z.number().optional().describe('收入'),
25 groupId: z.string().describe('账号分组 ID'),
26 status: z.coerce.number().pipe(z.enum(AccountStatus)).describe('账号状态'),
27 rank: z.number().optional().describe('排序值'),
28 relayAccountRef: z.string().nullable().optional().describe('转发账号引用'),
29 createdAt: z.coerce.date().optional().describe('创建时间'),
30 updatedAt: z.coerce.date().optional().describe('更新时间'),
31 })
32
33 export class ChannelAccountVo extends createZodDto(ChannelAccountVoSchema, 'ChannelAccountVo') {}
34
35 export const ChannelAccountListVoSchema = z.object({
36 total: z.number().describe('账号总数'),
37 list: z.array(ChannelAccountVoSchema).describe('账号列表'),
38 })
39
40 export class ChannelAccountListVo extends createZodDto(ChannelAccountListVoSchema, 'ChannelAccountListVo') {}
41
42 export const ChannelAccountAuthStatusVoSchema = z.object({
43 status: z.coerce.number().pipe(z.enum(AccountStatus)).describe('账号授权状态'),
44 })
45
46 export class ChannelAccountAuthStatusVo extends createZodDto(
47 ChannelAccountAuthStatusVoSchema,
48 'ChannelAccountAuthStatusVo',
49 ) {}
50
50 lines TYPESCRIPT