- Drop duration_minutes column from event_templates (model, schema, migration) - Remove duration field from TemplateForm UI and TypeScript types - EventForm now defaults start to current date/time and end to +1 hour when no initial values are provided (new events and template-based events) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from sqlalchemy import String, Text, Boolean, ForeignKey, Integer
|
|
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)
|
|
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)
|