41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""人员级别 Schema"""
|
|
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class StaffLevelBase(BaseModel):
|
|
"""人员级别基础字段"""
|
|
|
|
level_code: str = Field(..., min_length=1, max_length=20, description="级别编码")
|
|
level_name: str = Field(..., min_length=1, max_length=50, description="级别名称")
|
|
hourly_rate: float = Field(..., gt=0, description="时薪(元/小时)")
|
|
is_active: bool = Field(True, description="是否启用")
|
|
|
|
|
|
class StaffLevelCreate(StaffLevelBase):
|
|
"""创建人员级别请求"""
|
|
pass
|
|
|
|
|
|
class StaffLevelUpdate(BaseModel):
|
|
"""更新人员级别请求"""
|
|
|
|
level_code: Optional[str] = Field(None, min_length=1, max_length=20, description="级别编码")
|
|
level_name: Optional[str] = Field(None, min_length=1, max_length=50, description="级别名称")
|
|
hourly_rate: Optional[float] = Field(None, gt=0, description="时薪(元/小时)")
|
|
is_active: Optional[bool] = Field(None, description="是否启用")
|
|
|
|
|
|
class StaffLevelResponse(StaffLevelBase):
|
|
"""人员级别响应"""
|
|
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|