Refactor models and routes for item management
Reorganized model structure by replacing 'object' and 'items' with a unified 'item' model using UUIDs, and moved base model logic into separate files. Updated routes to use the new item model and improved request/response handling. Enhanced user and setting models, added utility functions, and improved error handling throughout the codebase. Also added initial .idea project files and minor admin API improvements. Co-Authored-By: 砂糖橘 <54745033+Foxerine@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
from sqlmodel import Field
|
||||
from .base import TableBase
|
||||
from .base import TableBase, SQLModelBase
|
||||
|
||||
class Setting(TableBase, table=True):
|
||||
|
||||
type: str = Field(index=True, nullable=False, description="设置类型")
|
||||
name: str = Field(primary_key=True, nullable=False, description="设置名称") # name 为唯一主键
|
||||
value: str | None = Field(description="设置值")
|
||||
class SettingBase(SQLModelBase):
|
||||
type: str = Field(index=True)
|
||||
"""设置类型"""
|
||||
|
||||
name: str = Field(index=True, unique=True) # name 为唯一主键
|
||||
"""设置名称"""
|
||||
|
||||
value: str | None
|
||||
"""设置值"""
|
||||
|
||||
class Setting(SettingBase, TableBase, table=True):
|
||||
pass
|
||||
|
||||
class SettingResponse(SettingBase):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user