| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-08-19 15:58:47 |
| 4 | * @LastEditTime: 2025-03-17 12:41:12 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: materialGroup MaterialGroup |
| 7 | */ |
| 8 | import { AccountType, createZodDto, TableDtoSchema } from '@yikart/common' |
| 9 | import { MaterialType } from '@yikart/mongodb' |
| 10 | import { z } from 'zod' |
| 11 | |
| 12 | export const MaterialGroupIdSchema = z.object({ |
| 13 | id: z.string().describe('ID'), |
| 14 | }) |
| 15 | export class MaterialGroupIdDto extends createZodDto(MaterialGroupIdSchema) {} |
| 16 | |
| 17 | export const CreateMaterialGroupSchema = z.object({ |
| 18 | type: z.enum(MaterialType).describe('素材类型'), |
| 19 | name: z.string().describe('标题'), |
| 20 | desc: z.string().optional().describe('描述'), |
| 21 | platforms: z.array(z.enum(AccountType)).optional().default([]).describe('平台限制'), |
| 22 | }) |
| 23 | export class CreateMaterialGroupDto extends createZodDto(CreateMaterialGroupSchema) {} |
| 24 | |
| 25 | export const UpdateMaterialGroupSchema = z.object({ |
| 26 | name: z.string().describe('标题'), |
| 27 | desc: z.string().optional().describe('描述'), |
| 28 | platforms: z.array(z.enum(AccountType)).optional().describe('平台限制'), |
| 29 | }) |
| 30 | export class UpdateMaterialGroupDto extends createZodDto(UpdateMaterialGroupSchema) {} |
| 31 | |
| 32 | export const MaterialGroupFilterSchema = z.object({ |
| 33 | title: z.string().optional().describe('标题'), |
| 34 | }) |
| 35 | export class MaterialGroupFilterDto extends createZodDto(MaterialGroupFilterSchema) {} |
| 36 | |
| 37 | export const MaterialGroupListSchema = z.object({ |
| 38 | filter: MaterialGroupFilterSchema.optional().describe('过滤条件'), |
| 39 | page: TableDtoSchema.describe('分页信息'), |
| 40 | }) |
| 41 | export class MaterialGroupListDto extends createZodDto(MaterialGroupListSchema) {} |
| 42 |