feat(database): 在用户模型中添加事件关系
- 在 User 类中添加了 events 字段,用于存储用户相关的事件 - 通过 Relationship 建立了用户和事件之间的关系 - 引入了 Event 模型以支持事件相关操作
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from datetime import UTC, datetime, timedelta
|
||||
from typing import TYPE_CHECKING, NotRequired, TypedDict
|
||||
|
||||
from app.database.events import Event
|
||||
from app.models.model import UTCBaseModel
|
||||
from app.models.score import GameMode
|
||||
from app.models.user import Country, Page, RankHistory
|
||||
@@ -151,7 +152,7 @@ class User(AsyncAttrs, UserBase, table=True):
|
||||
favourite_beatmapsets: list["FavouriteBeatmapset"] = Relationship(
|
||||
back_populates="user"
|
||||
)
|
||||
|
||||
events: list["Event"] = Relationship(back_populates="user")
|
||||
email: str = Field(max_length=254, unique=True, index=True, exclude=True)
|
||||
priv: int = Field(default=1, exclude=True)
|
||||
pw_bcrypt: str = Field(max_length=60, exclude=True)
|
||||
|
||||
Reference in New Issue
Block a user