- 21 个模块目录(auth/system/dictionary/configuration/cms/member/region/link/notice/job/log/upload/index) - 每个模块 router.py(合并模块导出多个 router)/schemas.py/service.py/repository.py/models.py - routers/v1.py 与 routers/__init__.py 改为直接引用 modules,前缀与权限串原样保留 - core/middleware.py 懒加载指向 modules.system.menu / modules.log;core/redis_client.py 指向 modules.job.scheduler - apps/views|services|forms 全部改为 re-export 垫片 - 迁移后 grep 守门通过:modules/core 无 apps/extensions 残留引用 - 实测登录、27+ 模块接口、写操作 commit、操作日志落库均正常 Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
1018 B
Python
29 lines
1018 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
# 角色表单验证
|
|
class RoleForm(BaseModel):
|
|
id: Optional[int] = Field(None, description="角色ID")
|
|
name: str = Field(..., min_length=1, max_length=150, description="角色名称")
|
|
code: str = Field(..., min_length=1, max_length=30, description="角色编码")
|
|
status: int = Field(..., ge=1, le=2, description="角色状态")
|
|
sort: int = Field(..., ge=0, le=99999, description="角色排序")
|
|
note: Optional[str] = Field(None, max_length=255, description="角色备注")
|
|
|
|
# 设置状态表单
|
|
class RoleStatusForm(BaseModel):
|
|
id: int = Field(..., gt=0, description="角色ID")
|
|
status: int = Field(..., ge=1, le=2, description="角色状态")
|
|
|
|
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
# 角色菜单表单
|
|
class RoleMenuForm(BaseModel):
|
|
role_id: int = Field(..., gt=0, description="角色ID")
|
|
menu_id: Optional[List[int]] = Field(default=[], description="菜单ID列表")
|