Files
disknext/models/response.py

27 lines
622 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
通用响应模型定义
"""
from typing import Any
import uuid
from sqlmodel import Field
from .base import SQLModelBase
# [TODO] 未来把这拆了,直接按需返回状态码
class ResponseModel(SQLModelBase):
"""通用响应模型"""
code: int = Field(default=0, ge=0, lt=60000)
"""系统内部状态码0表示成功其他表示失败"""
data: Any = None
"""响应数据"""
msg: str | None = None
"""响应消息,可以是错误消息或信息提示"""
instance_id: uuid.UUID = Field(default_factory=uuid.uuid4)
"""实例ID用于标识请求的唯一性"""