
- FastAPI application that monitors websites for updates - SQLite database with Website and WebsiteAlert models - REST API endpoints for website management and alerts - Background scheduler for automatic periodic checks - Content hashing to detect website changes - Health check endpoint and comprehensive documentation - Alembic migrations for database schema management - CORS middleware for cross-origin requests - Environment variable configuration support Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
1017 B
Python
25 lines
1017 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, DateTime, Text, Boolean
|
|
from app.db.base import Base
|
|
|
|
class Website(Base):
|
|
__tablename__ = "websites"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
url = Column(String, unique=True, index=True, nullable=False)
|
|
name = Column(String, nullable=False)
|
|
last_checked = Column(DateTime, default=datetime.utcnow)
|
|
last_content_hash = Column(String)
|
|
is_active = Column(Boolean, default=True)
|
|
check_interval_minutes = Column(Integer, default=60)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
class WebsiteAlert(Base):
|
|
__tablename__ = "website_alerts"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
website_id = Column(Integer, nullable=False)
|
|
alert_message = Column(Text, nullable=False)
|
|
detected_at = Column(DateTime, default=datetime.utcnow)
|
|
is_read = Column(Boolean, default=False) |