19 lines
759 B
Python
19 lines
759 B
Python
from sqlalchemy import Boolean, ForeignKey, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base, TimestampMixin
|
|
|
|
|
|
class Notification(Base, TimestampMixin):
|
|
__tablename__ = "notifications"
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
user_id: Mapped[str | None] = mapped_column(
|
|
String(32), ForeignKey("users.id", ondelete="CASCADE"), nullable=True, index=True
|
|
)
|
|
title: Mapped[str] = mapped_column(String(128))
|
|
content: Mapped[str] = mapped_column(Text)
|
|
type: Mapped[str] = mapped_column(String(32), default="system")
|
|
is_read: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
related_id: Mapped[str | None] = mapped_column(String(64), nullable=True)
|