| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { z } from '@hono/zod-openapi';
- export const ConfigSchema = z.object({
- id: z.number().int().positive().openapi({ description: '配置ID' }),
- key: z.string().min(1, '配置键名不能为空').max(255, '配置键名最多255个字符').openapi({
- description: '配置键名',
- example: 'site_name'
- }),
- value: z.string().min(1, '配置值不能为空').max(255, '配置值最多255个字符').openapi({
- description: '配置值',
- example: '站点名称'
- }),
- state: z.number().int().min(1).max(2).default(2).openapi({
- description: '状态 1可用 2禁用',
- example: 1
- }),
- createdAt: z.coerce.date().openapi({
- description: '创建时间',
- example: '2024-01-01T12:00:00Z'
- }),
- updatedAt: z.coerce.date().openapi({
- description: '更新时间',
- example: '2024-01-01T12:00:00Z'
- }),
- createdBy: z.number().int().positive().nullable().openapi({
- description: '创建用户ID',
- example: 1
- }),
- updatedBy: z.number().int().positive().nullable().openapi({
- description: '更新用户ID',
- example: 1
- })
- });
- export const CreateConfigDto = z.object({
- key: z.string().min(1, '配置键名不能为空').max(255, '配置键名最多255个字符').openapi({
- description: '配置键名',
- example: 'site_name'
- }),
- value: z.string().min(1, '配置值不能为空').max(255, '配置值最多255个字符').openapi({
- description: '配置值',
- example: '站点名称'
- }),
- state: z.number().int().min(1).max(2).default(2).openapi({
- description: '状态 1可用 2禁用',
- example: 1
- })
- });
- export const UpdateConfigDto = z.object({
- key: z.string().min(1, '配置键名不能为空').max(255, '配置键名最多255个字符').optional().openapi({
- description: '配置键名',
- example: 'site_name'
- }),
- value: z.string().min(1, '配置值不能为空').max(255, '配置值最多255个字符').optional().openapi({
- description: '配置值',
- example: '站点名称'
- }),
- state: z.number().int().min(1).max(2).optional().openapi({
- description: '状态 1可用 2禁用',
- example: 1
- })
- });
|