修复数据库调用问题

This commit is contained in:
2025-10-05 12:41:33 +08:00
parent c1c36c606f
commit ee684d67cf
11 changed files with 422 additions and 282 deletions

16
model/user.py Normal file
View File

@@ -0,0 +1,16 @@
from typing import TYPE_CHECKING
from sqlmodel import Field, Column, String, Boolean, Relationship
from .base import TableBase, IdMixin
if TYPE_CHECKING:
from .object import Object
class User(IdMixin, TableBase, table=True):
email: str = Field(sa_column=Column(String(100), index=True, unique=True))
username: str = Field(sa_column=Column(String(50), index=True, unique=True))
password: str = Field(sa_column=Column(String(100)))
is_admin: bool = Field(default=False, sa_column=Column(Boolean, default=False))
objects: list["Object"] = Relationship(back_populates="user")