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
23 lines
948 B
Python
23 lines
948 B
Python
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, UniqueConstraint
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Follow(Base):
|
|
__tablename__ = "follows"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
|
|
follow_type = Column(String(20), nullable=False) # bill | member | topic
|
|
follow_value = Column(String, nullable=False) # bill_id | bioguide_id | tag string
|
|
follow_mode = Column(String(20), nullable=False, default="neutral") # neutral | pocket_veto | pocket_boost
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
user = relationship("User", back_populates="follows")
|
|
|
|
__table_args__ = (
|
|
UniqueConstraint("user_id", "follow_type", "follow_value", name="uq_follows_user_type_value"),
|
|
)
|