|
|
@@ -1,5 +1,6 @@
|
|
|
import { z } from '@hono/zod-openapi';
|
|
|
import { DeleteStatus, DisabledStatus } from '@/share/types';
|
|
|
+import { FileSchema } from '@/server/modules/files/file.schema';
|
|
|
|
|
|
// 基础单词 schema(包含所有字段)
|
|
|
export const VocabularySchema = z.object({
|
|
|
@@ -29,7 +30,20 @@ export const VocabularySchema = z.object({
|
|
|
description: '是否删除(0:未删除,1:已删除)'
|
|
|
}),
|
|
|
createdAt: z.coerce.date().openapi({ description: '创建时间' }),
|
|
|
- updatedAt: z.coerce.date().openapi({ description: '更新时间' })
|
|
|
+ updatedAt: z.coerce.date().openapi({ description: '更新时间' }),
|
|
|
+ pronunciationFileId: z.number().int().positive().nullable().openapi({
|
|
|
+ example: 1,
|
|
|
+ description: '发音音频文件ID'
|
|
|
+ }),
|
|
|
+ pronunciationFile: z.object({
|
|
|
+ id: z.number().int().positive().openapi({ description: '文件ID' }),
|
|
|
+ name: z.string().max(255).openapi({ description: '文件名', example: 'hello.mp3' }),
|
|
|
+ fullUrl: z.string().openapi({ description: '文件完整URL', example: 'https://example.com/hello.mp3' }),
|
|
|
+ type: z.string().nullable().openapi({ description: '文件类型', example: 'audio/mpeg' }),
|
|
|
+ size: z.number().nullable().openapi({ description: '文件大小(字节)', example: 102400 })
|
|
|
+ }).nullable().optional().openapi({
|
|
|
+ description: '发音音频文件信息'
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
// 创建单词请求 schema
|
|
|
@@ -53,6 +67,10 @@ export const CreateVocabularyDto = z.object({
|
|
|
isDisabled: z.number().int().min(0, '状态值只能是0或1').max(1, '状态值只能是0或1').default(DisabledStatus.ENABLED).optional().openapi({
|
|
|
example: DisabledStatus.ENABLED,
|
|
|
description: '是否禁用(0:启用,1:禁用)'
|
|
|
+ }),
|
|
|
+ pronunciationFileId: z.number().int().positive().nullable().optional().openapi({
|
|
|
+ example: 1,
|
|
|
+ description: '发音音频文件ID'
|
|
|
})
|
|
|
});
|
|
|
|
|
|
@@ -77,6 +95,10 @@ export const UpdateVocabularyDto = z.object({
|
|
|
isDisabled: z.number().int().min(0, '状态值只能是0或1').max(1, '状态值只能是0或1').optional().openapi({
|
|
|
example: DisabledStatus.ENABLED,
|
|
|
description: '是否禁用(0:启用,1:禁用)'
|
|
|
+ }),
|
|
|
+ pronunciationFileId: z.number().int().positive().nullable().optional().openapi({
|
|
|
+ example: 1,
|
|
|
+ description: '发音音频文件ID'
|
|
|
})
|
|
|
});
|
|
|
|