Self-hosted US Congress monitoring platform with AI policy briefs, bill/member/topic follows, ntfy + RSS + email notifications, alignment scoring, collections, and draft-letter generator. Authored by: Jack Levy
25 lines
1.2 KiB
Python
25 lines
1.2 KiB
Python
from sqlalchemy import Boolean, Column, DateTime, Integer, String
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
email = Column(String, unique=True, nullable=False, index=True)
|
|
hashed_password = Column(String, nullable=False)
|
|
is_admin = Column(Boolean, nullable=False, default=False)
|
|
notification_prefs = Column(JSONB, nullable=False, default=dict)
|
|
rss_token = Column(String, unique=True, nullable=True, index=True)
|
|
email_unsubscribe_token = Column(String(64), unique=True, nullable=True, index=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
follows = relationship("Follow", back_populates="user", cascade="all, delete-orphan")
|
|
notification_events = relationship("NotificationEvent", back_populates="user", cascade="all, delete-orphan")
|
|
bill_notes = relationship("BillNote", back_populates="user", cascade="all, delete-orphan")
|
|
collections = relationship("Collection", back_populates="user", cascade="all, delete-orphan")
|