modify: auth 插件

This commit is contained in:
2026-07-23 17:45:44 +08:00
parent 95ef842d92
commit 2b7b8ee08c
21 changed files with 753 additions and 43 deletions
+3
View File
@@ -16,6 +16,8 @@ from .pydantic import MultiplyGetResponse
from .pydantic import SubtractGetRequest
from .pydantic import SubtractGetResponse
from .counter import Counter
__all__ = [
"AddGetRequest",
"AddGetResponse",
@@ -29,4 +31,5 @@ __all__ = [
"MultiplyGetResponse",
"SubtractGetRequest",
"SubtractGetResponse",
"Counter"
]
+6 -12
View File
@@ -1,14 +1,8 @@
# src/plugins/example/models/counter.py
from pydantic import BaseModel
import modelvault
from sqlmodel import Field, SQLModel
class Counter(BaseModel):
# 主键字段
__modelvault_primary_key__ = "name"
# 唯一索引
__modelvault_indexes__ = [
modelvault.models.unique("name"),
]
name: str # 计数器名称(例如 "visits")
value: int = 0
class Counter(SQLModel, table=True):
__tablename__ = "counter" # type: ignore
name: str = Field(primary_key=True, index=True)
value: int = Field(default=0)