Add per-calendar reminders_enabled flag (server)

New boolean column on every calendar type (CalDAV, local, Google, Home
Assistant, iCal subscription), default ON so existing data is unchanged.
Lets a calendar be shown without generating reminders/notifications.

- models.py: reminders_enabled on the five calendar models
- main.py _migrate(): ALTER TABLE ADD COLUMN for each table
- caldav/google/homeassistant/local/ical routers: expose the flag in the
  calendar serialization and accept it in the calendar/subscription update
  endpoints

Clients map event -> (source, calendar_id) -> reminders_enabled to skip
scheduling notifications for disabled calendars.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-06-09 18:16:45 +02:00
parent bff9a244e7
commit 14dea01053
7 changed files with 39 additions and 0 deletions

View File

@@ -201,6 +201,15 @@ def _migrate():
logging.info("Migration: added color to group_members")
except Exception:
pass
# Per-calendar reminder toggle (default ON = unchanged behaviour for existing data).
for tbl in ("calendars", "local_calendars", "google_calendars",
"homeassistant_calendars", "ical_subscriptions"):
try:
conn.execute(text(f"ALTER TABLE {tbl} ADD COLUMN reminders_enabled BOOLEAN DEFAULT 1"))
conn.commit()
logging.info("Migration: added reminders_enabled to %s", tbl)
except Exception:
pass
_migrate()