
- 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>
36 lines
803 B
Python
36 lines
803 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel, HttpUrl
|
|
|
|
class WebsiteCreate(BaseModel):
|
|
url: HttpUrl
|
|
name: str
|
|
check_interval_minutes: Optional[int] = 60
|
|
|
|
class WebsiteUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
check_interval_minutes: Optional[int] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
class WebsiteResponse(BaseModel):
|
|
id: int
|
|
url: str
|
|
name: str
|
|
last_checked: Optional[datetime]
|
|
is_active: bool
|
|
check_interval_minutes: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class AlertResponse(BaseModel):
|
|
id: int
|
|
website_id: int
|
|
alert_message: str
|
|
detected_at: datetime
|
|
is_read: bool
|
|
|
|
class Config:
|
|
from_attributes = True |