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:
@@ -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}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user