feat: 实现ID生成器并重构模型ID生成逻辑

refactor: 统一ID生成方式,使用新的idGenerator模块
refactor: 重构模型ID生成逻辑,允许空ID并在创建前自动生成
fix(roomSchema): 使机房ID字段变为可选并更新前端表单验证
style: 格式化代码并优化导入语句
test: 添加操作日志集成测试文件
docs: 添加错误处理模块文档
This commit is contained in:
zhang1106
2026-04-02 10:34:13 +08:00
parent ea67951dd4
commit 7f1df28858
28 changed files with 451 additions and 91 deletions
+1 -2
View File
@@ -3,14 +3,13 @@ const Joi = require('joi');
// 创建机房验证Schema
const createRoomSchema = Joi.object({
roomId: Joi.string()
.required()
.optional()
.max(50)
.pattern(/^[a-zA-Z0-9_-]+$/)
.messages({
'string.empty': '机房ID不能为空',
'string.max': '机房ID不能超过50个字符',
'string.pattern.base': '机房ID只能包含字母、数字、下划线和横线',
'any.required': '机房ID是必填字段',
}),
name: Joi.string().required().max(100).messages({