优化代码风格
This commit is contained in:
@ -4,12 +4,12 @@ from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# ------------------------------
|
||||
# 请求模型(新增记录用,极简)
|
||||
# 请求模型
|
||||
# ------------------------------
|
||||
class DeviceActionCreate(BaseModel):
|
||||
"""设备操作记录创建模型(0=离线,1=上线)"""
|
||||
"""设备操作记录创建模型(0=离线、1=上线)"""
|
||||
client_ip: str = Field(..., description="客户端IP")
|
||||
action: int = Field(..., ge=0, le=1, description="操作状态(0=离线,1=上线)")
|
||||
action: int = Field(..., ge=0, le=1, description="操作状态(0=离线、1=上线)")
|
||||
|
||||
|
||||
# ------------------------------
|
||||
@ -19,7 +19,7 @@ class DeviceActionResponse(BaseModel):
|
||||
"""设备操作记录响应模型(与自增表对齐)"""
|
||||
id: int = Field(..., description="自增主键ID")
|
||||
client_ip: Optional[str] = Field(None, description="客户端IP")
|
||||
action: Optional[int] = Field(None, description="操作状态(0=离线,1=上线)")
|
||||
action: Optional[int] = Field(None, description="操作状态(0=离线、1=上线)")
|
||||
created_at: datetime = Field(..., description="记录创建时间")
|
||||
updated_at: datetime = Field(..., description="记录更新时间")
|
||||
|
||||
|
Reference in New Issue
Block a user