Add enhanced models, scheduled jobs, per-locale templates (Phase 7b)
Some checks failed
Validate / Hassfest (push) Has been cancelled
Some checks failed
Validate / Hassfest (push) Has been cancelled
Backend changes for full blueprint feature parity: Database models: - MessageTemplate: add body_ru (locale variant), event_type field - AlbumTracker: add track_images, track_videos, notify_favorites_only, include_people, include_asset_details, max_assets_to_show, assets_order_by, assets_order fields - New ScheduledJob model: supports periodic_summary, scheduled_assets, and memory (On This Day) notification modes with full config (times, interval, album_mode, limit, filters, sorting) API: - New /api/scheduled/* CRUD endpoints for scheduled jobs - Tracker create/update accept all new filtering fields - Tracker response includes new fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,8 @@ class MessageTemplate(SQLModel, table=True):
|
||||
user_id: int = Field(foreign_key="user.id")
|
||||
name: str
|
||||
body: str = Field(default="")
|
||||
body_ru: str = Field(default="") # Russian locale variant (empty = use body)
|
||||
event_type: str = Field(default="") # "" = all events, or specific type
|
||||
is_default: bool = Field(default=False)
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
|
||||
@@ -82,6 +84,43 @@ class AlbumTracker(SQLModel, table=True):
|
||||
enabled: bool = Field(default=True)
|
||||
quiet_hours_start: str | None = None # "HH:MM"
|
||||
quiet_hours_end: str | None = None # "HH:MM"
|
||||
# Enhanced filtering (matching HAOS blueprint)
|
||||
track_images: bool = Field(default=True)
|
||||
track_videos: bool = Field(default=True)
|
||||
notify_favorites_only: bool = Field(default=False)
|
||||
include_people: bool = Field(default=True)
|
||||
include_asset_details: bool = Field(default=False)
|
||||
max_assets_to_show: int = Field(default=5)
|
||||
assets_order_by: str = Field(default="none") # none/date/rating/name/random
|
||||
assets_order: str = Field(default="descending")
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
|
||||
|
||||
class ScheduledJob(SQLModel, table=True):
|
||||
"""Scheduled notification job (periodic summary, scheduled assets, memory mode)."""
|
||||
|
||||
__tablename__ = "scheduled_job"
|
||||
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
tracker_id: int = Field(foreign_key="album_tracker.id")
|
||||
job_type: str # "periodic_summary", "scheduled_assets", "memory"
|
||||
enabled: bool = Field(default=True)
|
||||
# Timing
|
||||
times: str = Field(default="09:00") # "HH:MM, HH:MM"
|
||||
interval_days: int = Field(default=1) # For periodic: 1=daily, 7=weekly
|
||||
start_date: str = Field(default="2025-01-01") # For periodic interval anchor
|
||||
# Asset fetching config (scheduled_assets + memory modes)
|
||||
album_mode: str = Field(default="per_album") # per_album/combined/random
|
||||
limit: int = Field(default=10)
|
||||
favorite_only: bool = Field(default=False)
|
||||
asset_type: str = Field(default="all") # all/photo/video
|
||||
min_rating: int = Field(default=0) # 0=no filter, 1-5
|
||||
order_by: str = Field(default="random")
|
||||
order: str = Field(default="descending")
|
||||
min_date: str | None = None
|
||||
max_date: str | None = None
|
||||
# Template
|
||||
message_template: str = Field(default="") # Custom Jinja2 template for this job
|
||||
created_at: datetime = Field(default_factory=_utcnow)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user