| 1 | import { AccountType, createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | import { ChannelPaginationInputWithDefaultSchema } from '../platforms/platform-pagination.dto' |
| 4 | |
| 5 | export const WorkPlatformParamsSchema = z.object({ |
| 6 | platform: z.enum(AccountType).describe('平台'), |
| 7 | platformWorkId: z.string().min(1).describe('平台作品 ID'), |
| 8 | }) |
| 9 | |
| 10 | export class WorkPlatformParamsDto extends createZodDto(WorkPlatformParamsSchema) {} |
| 11 | |
| 12 | export const WorkListPlatformParamsSchema = z.object({ |
| 13 | platform: z.enum(AccountType).describe('平台'), |
| 14 | }) |
| 15 | |
| 16 | export class WorkListPlatformParamsDto extends createZodDto(WorkListPlatformParamsSchema) {} |
| 17 | |
| 18 | export const WorkLinkInfoQuerySchema = z.object({ |
| 19 | platform: z.enum(AccountType).describe('平台'), |
| 20 | link: z.string().min(1).describe('作品链接'), |
| 21 | accountId: z.string().min(1).optional().describe('账号 ID'), |
| 22 | }) |
| 23 | |
| 24 | export class WorkLinkInfoQueryDto extends createZodDto(WorkLinkInfoQuerySchema) {} |
| 25 | |
| 26 | export const WorkAccountQuerySchema = z.object({ |
| 27 | accountId: z.string().min(1).optional().describe('账号 ID'), |
| 28 | }) |
| 29 | |
| 30 | export class WorkAccountQueryDto extends createZodDto(WorkAccountQuerySchema) {} |
| 31 | |
| 32 | export const WorkListQuerySchema = z.object({ |
| 33 | accountId: z.string().min(1).describe('账号 ID'), |
| 34 | pagination: ChannelPaginationInputWithDefaultSchema.describe('分页参数'), |
| 35 | }) |
| 36 | |
| 37 | export class WorkListQueryDto extends createZodDto(WorkListQuerySchema) {} |
| 38 | |
| 39 | export const WorkAnalyticsQuerySchema = WorkAccountQuerySchema.extend({ |
| 40 | since: z.coerce.date().optional().describe('开始时间'), |
| 41 | until: z.coerce.date().optional().describe('结束时间'), |
| 42 | }) |
| 43 | |
| 44 | export class WorkAnalyticsQueryDto extends createZodDto(WorkAnalyticsQuerySchema) {} |
| 45 | |
| 46 | export const WorkOwnershipBodySchema = z.object({ |
| 47 | candidateAccountId: z.string().min(1).describe('候选账号 ID'), |
| 48 | }) |
| 49 | |
| 50 | export class WorkOwnershipBodyDto extends createZodDto(WorkOwnershipBodySchema) {} |
| 51 |