Notifications: - New /notifications page accessible to all users (ntfy + RSS config) - ntfy now supports no-auth, Bearer token, and HTTP Basic auth (for ACL-protected self-hosted servers) - RSS enabled/disabled independently of ntfy; token auto-generated on first GET - Notification settings removed from admin-only Settings page; replaced with link card - Sidebar adds Notifications nav link for all users - notification_dispatcher.py: fan-out now marks RSS events dispatched independently Action history: - Migration 0012: deduplicates existing bill_actions rows and adds UNIQUE(bill_id, action_date, action_text) - congress_poller.py: replaces existence-check inserts with ON CONFLICT DO NOTHING (race-condition safe) - Added backfill_all_bill_actions task (no date filter) + admin endpoint POST /backfill-all-actions Authored-By: Jack Levy
22 lines
933 B
Python
22 lines
933 B
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)
|
|
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")
|