Coverage for polar/models/notification.py: 88%
15 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 17:15 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 17:15 +0000
1from typing import TYPE_CHECKING 1ab
2from uuid import UUID 1ab
4from sqlalchemy import ForeignKey, String, Uuid 1ab
5from sqlalchemy.dialects.postgresql import JSONB 1ab
6from sqlalchemy.orm import Mapped, mapped_column, relationship 1ab
8from polar.kit.db.models import RecordModel 1ab
9from polar.types import JSONDict 1ab
11if TYPE_CHECKING: 11 ↛ 12line 11 didn't jump to line 12 because the condition on line 11 was never true1ab
12 from polar.models import User
15class Notification(RecordModel): 1ab
16 __tablename__ = "notifications" 1ab
18 user_id: Mapped[UUID] = mapped_column( 1ab
19 Uuid, ForeignKey("users.id", ondelete="cascade"), nullable=False, index=True
20 )
21 type: Mapped[str] = mapped_column(String, nullable=False) 1ab
22 payload: Mapped[JSONDict] = mapped_column(JSONB, nullable=False, default=dict) 1ab
24 user: Mapped["User"] = relationship("User", lazy="raise") 1ab