- Add wheel scroll navigation in month view (debounced, prevents rapid scrolling) - Allow editing color on system calendars (Birthdays) - name field disabled - Event templates: full CRUD backend (model, schema, router, migration 011) - Event templates: sidebar section with create/edit/delete, click to pre-fill EventForm - Register event_templates router at /api/event-templates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
from sqlalchemy import String, Text, Integer, Boolean, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from app.database import Base
|
|
|
|
|
|
class EventTemplate(Base):
|
|
__tablename__ = "event_templates"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
description: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
duration_minutes: Mapped[int] = mapped_column(Integer, default=60)
|
|
calendar_id: Mapped[Optional[int]] = mapped_column(
|
|
Integer, ForeignKey("calendars.id", ondelete="SET NULL"), nullable=True
|
|
)
|
|
recurrence_rule: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
all_day: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
location_id: Mapped[Optional[int]] = mapped_column(
|
|
Integer, ForeignKey("locations.id", ondelete="SET NULL"), nullable=True
|
|
)
|
|
is_starred: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
|