This commit is contained in:
2026-06-14 11:16:42 +08:00
parent ca39190ad7
commit c9fc87cd89
35 changed files with 1480 additions and 18 deletions
+4 -1
View File
@@ -21,12 +21,15 @@ class Message(Base):
sender_id: Mapped[str] = mapped_column(
String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=False
)
type: Mapped[str] = mapped_column(String(20), default="text") # text / image / file / system
type: Mapped[str] = mapped_column(String(20), default="text") # text / image / file / voice / system
content: Mapped[str] = mapped_column(Text, nullable=False)
reply_to_id: Mapped[str | None] = mapped_column(
String(36), ForeignKey("messages.id", ondelete="SET NULL"), nullable=True
)
mentions: Mapped[str | None] = mapped_column(Text, nullable=True) # JSON: 被@的用户ID列表
is_deleted: Mapped[bool] = mapped_column(Boolean, default=False)
is_recalled: Mapped[bool] = mapped_column(Boolean, default=False) # 撤回
recalled_at: Mapped[datetime | None] = mapped_column(DateTime, nullable=True)
created_at: Mapped[datetime] = mapped_column(
DateTime, default=lambda: datetime.utcnow(), index=True
)