feat(sharing): recipients can recolour a shared calendar (per-user, no rename)

A share recipient couldn't change anything on a shared calendar (update_calendar
is owner-only → 404), yet the clients still showed a colour picker for it.

Add a per-recipient colour: new nullable calendar_shares.color column (+ migration).
New PUT /calendars/{id}/color endpoint sets the calendar colour for the owner
(global) or, for a recipient, only their own share colour — never the name, so
recipients can recolour but not rename. The merge read and the calendar list now
prefer the recipient's share colour over the owner's (NULL = owner's colour).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-07-06 20:40:13 +02:00
parent cad48efcc6
commit 343f7a5e7b
4 changed files with 46 additions and 4 deletions

View File

@@ -307,6 +307,7 @@ class CalendarShare(Base):
calendar_id = Column(Integer, ForeignKey("local_calendars.id"), nullable=False)
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
permission = Column(String(20), default="read") # 'read' | 'read_write'
color = Column(String(16), nullable=True) # recipient's own colour; NULL = owner's
created_at = Column(String(50), nullable=True) # ISO 8601
calendar = relationship("LocalCalendar")