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:
@@ -42,6 +42,7 @@ class CalendarUpdate(BaseModel):
|
||||
color: Optional[str] = None
|
||||
name: Optional[str] = None
|
||||
sidebar_hidden: Optional[bool] = None
|
||||
reminders_enabled: Optional[bool] = None
|
||||
|
||||
|
||||
class EventCreate(BaseModel):
|
||||
@@ -84,6 +85,7 @@ def _account_dict(a: models.CalDAVAccount) -> dict:
|
||||
"enabled": c.enabled,
|
||||
"cal_id": c.cal_id,
|
||||
"sidebar_hidden": bool(c.sidebar_hidden),
|
||||
"reminders_enabled": bool(c.reminders_enabled),
|
||||
}
|
||||
for c in a.calendars
|
||||
],
|
||||
@@ -270,6 +272,8 @@ def update_calendar(
|
||||
calendar.name = data.name
|
||||
if data.sidebar_hidden is not None:
|
||||
calendar.sidebar_hidden = data.sidebar_hidden
|
||||
if data.reminders_enabled is not None:
|
||||
calendar.reminders_enabled = data.reminders_enabled
|
||||
db.commit()
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user