| 1 | import { createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | |
| 4 | const ApiKeyCreatedVoSchema = z.object({ |
| 5 | id: z.string().describe('API Key ID'), |
| 6 | name: z.string().describe('名称'), |
| 7 | key: z.string().describe('API Key 明文(仅创建时返回一次)'), |
| 8 | createdAt: z.coerce.date().describe('创建时间'), |
| 9 | }) |
| 10 | export class ApiKeyCreatedVo extends createZodDto(ApiKeyCreatedVoSchema, 'ApiKeyCreatedVo') {} |
| 11 | |
| 12 | const ApiKeyItemVoSchema = z.object({ |
| 13 | id: z.string().describe('API Key ID'), |
| 14 | name: z.string().describe('名称'), |
| 15 | lastUsedAt: z.coerce.date().nullable().describe('最后使用时间'), |
| 16 | createdAt: z.coerce.date().describe('创建时间'), |
| 17 | }) |
| 18 | export class ApiKeyItemVo extends createZodDto(ApiKeyItemVoSchema, 'ApiKeyItemVo') {} |
| 19 |