- 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>
28 lines
556 B
Python
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)
|