| 1 | import { AccountType, createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | import { ChannelPaginationResultVoSchema } from '../platforms/platform-pagination.vo' |
| 4 | import { ChannelEngagementActionType, ChannelEngagementTargetType } from '../platforms/platforms.interface' |
| 5 | |
| 6 | export const ChannelCommentVoSchema = z.object({ |
| 7 | platformCommentId: z.string().describe('平台评论 ID'), |
| 8 | platformWorkId: z.string().optional().describe('平台作品 ID'), |
| 9 | parentCommentId: z.string().optional().describe('父评论 ID'), |
| 10 | authorName: z.string().optional().describe('评论作者名称'), |
| 11 | authorPlatformUid: z.string().optional().describe('评论作者平台 UID'), |
| 12 | content: z.string().describe('评论内容'), |
| 13 | createdAt: z.coerce.date().optional().describe('评论时间'), |
| 14 | likeCount: z.number().int().nonnegative().optional().describe('点赞数'), |
| 15 | replyCount: z.number().int().nonnegative().optional().describe('回复数'), |
| 16 | }) |
| 17 | |
| 18 | export const ChannelCommentListVoSchema = z.object({ |
| 19 | platform: z.enum(AccountType).describe('平台'), |
| 20 | items: z.array(ChannelCommentVoSchema).describe('评论列表'), |
| 21 | pagination: ChannelPaginationResultVoSchema.describe('分页结果'), |
| 22 | }) |
| 23 | |
| 24 | export class ChannelCommentListVo extends createZodDto( |
| 25 | ChannelCommentListVoSchema, |
| 26 | 'ChannelCommentListVo', |
| 27 | ) {} |
| 28 | |
| 29 | export const ChannelEngagementActionVoSchema = z.object({ |
| 30 | platform: z.enum(AccountType).describe('平台'), |
| 31 | actionType: z.enum(ChannelEngagementActionType).describe('互动动作类型'), |
| 32 | targetType: z.enum(ChannelEngagementTargetType).describe('互动目标类型'), |
| 33 | targetId: z.string().describe('互动目标 ID'), |
| 34 | platformActionId: z.string().optional().describe('平台返回的动作 ID'), |
| 35 | success: z.boolean().describe('操作是否成功'), |
| 36 | createdAt: z.coerce.date().optional().describe('动作创建时间'), |
| 37 | }) |
| 38 | |
| 39 | export class ChannelEngagementActionVo extends createZodDto( |
| 40 | ChannelEngagementActionVoSchema, |
| 41 | 'ChannelEngagementActionVo', |
| 42 | ) {} |
| 43 |