system-config.schema.mt.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { z } from '@hono/zod-openapi';
  2. export const SystemConfigSchema = z.object({
  3. id: z.number().int().positive().openapi({
  4. description: '系统配置ID',
  5. example: 1
  6. }),
  7. tenantId: z.number().int().positive().openapi({
  8. description: '租户ID',
  9. example: 1
  10. }),
  11. configKey: z.string().min(1).max(255).openapi({
  12. description: '配置键',
  13. example: 'app.login.enabled'
  14. }),
  15. configValue: z.string().openapi({
  16. description: '配置值',
  17. example: 'true'
  18. }),
  19. description: z.string().nullable().openapi({
  20. description: '配置描述',
  21. example: '控制小程序登录功能是否开启'
  22. }),
  23. createdBy: z.number().int().positive().nullable().openapi({
  24. description: '创建用户ID',
  25. example: 1
  26. }),
  27. updatedBy: z.number().int().positive().nullable().openapi({
  28. description: '更新用户ID',
  29. example: 1
  30. }),
  31. createdAt: z.coerce.date().openapi({
  32. description: '创建时间',
  33. example: '2023-01-15T10:30:00Z'
  34. }),
  35. updatedAt: z.coerce.date().openapi({
  36. description: '更新时间',
  37. example: '2023-01-16T14:20:00Z'
  38. })
  39. });
  40. export const CreateSystemConfigSchema = z.object({
  41. configKey: z.string().min(1).max(255).openapi({
  42. description: '配置键',
  43. example: 'app.login.enabled'
  44. }),
  45. configValue: z.string().openapi({
  46. description: '配置值',
  47. example: 'true'
  48. }),
  49. description: z.string().nullable().optional().openapi({
  50. description: '配置描述',
  51. example: '控制小程序登录功能是否开启'
  52. })
  53. });
  54. export const UpdateSystemConfigSchema = z.object({
  55. configKey: z.string().min(1).max(255).optional().openapi({
  56. description: '配置键',
  57. example: 'app.login.enabled'
  58. }),
  59. configValue: z.string().optional().openapi({
  60. description: '配置值',
  61. example: 'false'
  62. }),
  63. description: z.string().nullable().optional().openapi({
  64. description: '配置描述',
  65. example: '控制小程序登录功能是否开启'
  66. })
  67. });
  68. export const SystemConfigListSchema = z.array(SystemConfigSchema);