Add, change and delete calendar events from journal pages

CalDAV and Google calendars can now be written to from the journal on
the web and in the phone app. Each change goes to the source at once
with If-Match set to the ETag the last sync read, so a change made
elsewhere is refused (409) instead of overwritten; the account is then
read again. Repeating events, iCal feeds and read-only Google calendars
stay read-only.

- calendar_events keep each event's calendar, object/event id, ETag and
  whether it repeats; accounts keep their writable calendars and the
  one new events go to (migration 1764800000_calendar_writes).
- Google sign-in asks for calendar.events; older read-only accounts are
  offered "Connect again".
- New API: POST /calendar/events, PATCH and DELETE /calendar/events/{id}.
- Translations, Docs-Site guides and changelog updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-17 12:17:28 +01:00
1 parent 7f09338b60
commit 29465e4617
34 files changed
+3238 -223

No files matched your search

+93 -4
View File
@@ -2921,8 +2921,12 @@ paths:
get:
operationId: connectGoogleCalendar
tags: [calendars]
summary: Where to send the browser to connect a Google account's calendars (read-only)
description: Needs DOCWELL_GOOGLE_CLIENT_ID and DOCWELL_GOOGLE_CLIENT_SECRET. Afterwards the browser returns to account settings.
summary: Where to send the browser to connect a Google account's calendars
description: >-
Needs DOCWELL_GOOGLE_CLIENT_ID and DOCWELL_GOOGLE_CLIENT_SECRET. Asks to read calendars and to manage
events; when the person leaves events unticked, the account stays read-only (canWrite false).
Connecting the same Google account again replaces its sign-in. Afterwards the browser returns to
account settings.
security: [{ bearer: [] }]
responses:
"200":
@@ -3167,6 +3171,64 @@ paths:
application/json:
schema: { type: array, items: { $ref: "#/components/schemas/CalendarEvent" } }
"400": { $ref: "#/components/responses/Error" }
post:
operationId: createCalendarEvent
tags: [calendars]
summary: Add an event to one of the caller's calendars
description: >-
Written to the source at once (CalDAV PUT, Google Calendar API), into the account's writeTo calendar.
Needs a calendar whose canWrite is true. Timed events are stored in UTC.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarEventInput" }
responses:
"201":
description: Created
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarEvent" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
/api/v1/calendar/events/{id}:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
patch:
operationId: updateCalendarEvent
tags: [calendars]
summary: Change an event (editable ones only) at its source
description: >-
Sent with the ETag the last sync read. When the event changed in its calendar since, nothing is
overwritten: the answer is 409, the calendar is read again and the journal shows it as it is now.
Moving an event changes its id. Repeating events cannot be changed here.
security: [{ bearer: [] }]
requestBody:
required: true
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarEventInput" }
responses:
"200":
description: The event as it is now
content:
application/json:
schema: { $ref: "#/components/schemas/CalendarEvent" }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
delete:
operationId: deleteCalendarEvent
tags: [calendars]
summary: Delete an event (editable ones only) from its calendar
description: Guarded by the event's ETag like a change; 409 when it changed in its calendar since.
security: [{ bearer: [] }]
responses:
"204": { description: Deleted }
"400": { $ref: "#/components/responses/Error" }
"404": { $ref: "#/components/responses/Error" }
"409": { $ref: "#/components/responses/Error" }
/api/v1/workspaces/{id}/journals:
parameters:
- { name: id, in: path, required: true, schema: { type: string } }
@@ -5393,7 +5455,7 @@ components:
enabled: { type: boolean }
CalendarAccount:
type: object
required: [id, name, kind, url, username, hasPassword, color, enabled, lastSync, lastError, events, created]
required: [id, name, kind, url, username, hasPassword, color, enabled, lastSync, lastError, events, created, canWrite, needsReconnect, targets, writeTo]
properties:
id: { type: string }
name: { type: string }
@@ -5407,6 +5469,31 @@ components:
lastError: { type: string, description: Why the last read failed; empty when it worked }
events: { type: integer, description: Events the source held then (repeating ones once) }
created: { type: string }
canWrite: { type: boolean, description: Events can be added to and changed in this calendar }
needsReconnect: { type: boolean, description: "A Google account connected read-only; connecting it again allows editing" }
targets:
type: array
description: The account's calendars new events can go to (filled by a sync)
items: { $ref: "#/components/schemas/CalendarTarget" }
writeTo: { type: string, description: "The target new events go to; empty when there is none" }
CalendarTarget:
type: object
required: [id, name]
properties:
id: { type: string, description: "A CalDAV collection path or a Google calendar id" }
name: { type: string, description: Empty when the account is a single CalDAV calendar }
CalendarEventInput:
type: object
description: Creating needs calendar, title and start; changing sends only what changes.
properties:
calendar: { type: string, description: "The calendar account's id (creating only)" }
title: { type: string, maxLength: 500 }
location: { type: string, maxLength: 500 }
start: { type: string, description: "RFC 3339 time, or a date (YYYY-MM-DD) when allDay" }
end:
type: string
description: "Exclusive, written like start; missing is an hour (or a day) after start, or the old length when moving"
allDay: { type: boolean }
CalendarAccountInput:
type: object
properties:
@@ -5418,9 +5505,10 @@ components:
clearPassword: { type: boolean }
color: { $ref: "#/components/schemas/LabelColor" }
enabled: { type: boolean }
writeTo: { type: string, description: "One of the account's targets (changing only); empty for the first" }
CalendarEvent:
type: object
required: [id, calendar, title, location, url, start, end, allDay, color]
required: [id, calendar, title, location, url, start, end, allDay, color, editable]
properties:
id: { type: string }
calendar: { type: string, description: The calendar account's id }
@@ -5431,6 +5519,7 @@ components:
end: { type: string, description: "Exclusive; a date for all-day events" }
allDay: { type: boolean }
color: { $ref: "#/components/schemas/LabelColor" }
editable: { type: boolean, description: "Can be changed and deleted here: a single event in a calendar that takes changes" }
LabelColor:
type: string
enum: ["", gray, red, orange, yellow, green, teal, blue, purple, pink]