UMBRA/backend/app/schemas/calendar.py
Kyle Pope 093bceed06 Add multi-calendar backend support with virtual birthday events
- New Calendar model and calendars table with system/default flags
- Alembic migration 006: creates calendars, seeds Personal+Birthdays, migrates existing events
- CalendarEvent model gains calendar_id FK and calendar_name/calendar_color properties
- Updated CalendarEventCreate/Response schemas to include calendar fields
- New /api/calendars CRUD router (blocks system calendar deletion/rename)
- Events router: selectinload on all queries, default-calendar assignment on POST, virtual birthday event generation from People with birthdays when Birthdays calendar is visible

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:07:35 +08:00

28 lines
556 B
Python

from pydantic import BaseModel, ConfigDict
from datetime import datetime
from typing import Optional
class CalendarCreate(BaseModel):
name: str
color: str = "#3b82f6"
class CalendarUpdate(BaseModel):
name: Optional[str] = None
color: Optional[str] = None
is_visible: Optional[bool] = None
class CalendarResponse(BaseModel):
id: int
name: str
color: str
is_default: bool
is_system: bool
is_visible: bool
created_at: datetime
updated_at: datetime
model_config = ConfigDict(from_attributes=True)