| 1 | import { createPaginationVo, createZodDto, FileUtil, UserType } from '@yikart/common' |
| 2 | import { AssetStatus, AssetType } from '@yikart/mongodb' |
| 3 | import { z } from 'zod' |
| 4 | import { AssetMetadataSchema } from '../dto' |
| 5 | |
| 6 | export const AssetVoSchema = z.object({ |
| 7 | id: z.string(), |
| 8 | userId: z.string(), |
| 9 | userType: z.enum(UserType), |
| 10 | path: z.string(), |
| 11 | url: FileUtil.zodBuildUrl(), |
| 12 | type: z.enum(AssetType), |
| 13 | status: z.enum(AssetStatus), |
| 14 | size: z.number().optional(), |
| 15 | mimeType: z.string(), |
| 16 | filename: z.string().optional(), |
| 17 | metadata: AssetMetadataSchema.optional(), |
| 18 | createdAt: z.coerce.date(), |
| 19 | updatedAt: z.coerce.date(), |
| 20 | }) |
| 21 | export class AssetVo extends createZodDto(AssetVoSchema, 'AssetVo') {} |
| 22 | |
| 23 | export class AssetListVo extends createPaginationVo(AssetVoSchema, 'AssetListVo') {} |
| 24 |