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

@@ -30,6 +30,7 @@ class CalendarUpdate(BaseModel):
name: Optional[str] = None
color: Optional[str] = None
enabled: Optional[bool] = None
reminders_enabled: Optional[bool] = None
class EventCreate(BaseModel):
@@ -72,6 +73,7 @@ def _cal_dict(cal: models.LocalCalendar, *, owned: bool = True,
"name": cal.name,
"color": cal.color,
"enabled": cal.enabled,
"reminders_enabled": bool(cal.reminders_enabled),
"type": "local",
"owned": owned,
}
@@ -199,6 +201,8 @@ def update_calendar(
cal.color = data.color
if data.enabled is not None:
cal.enabled = data.enabled
if data.reminders_enabled is not None:
cal.reminders_enabled = data.reminders_enabled
db.commit()
return {"ok": True}