重构前保存现有 apps/ 结构基线,供后续各阶段回滚。 Co-Authored-By: Claude <noreply@anthropic.com>
18 lines
746 B
Python
18 lines
746 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="角色状态")
|