diff --git a/backend/app/models/event_template.py b/backend/app/models/event_template.py index ed4cbee..47004de 100644 --- a/backend/app/models/event_template.py +++ b/backend/app/models/event_template.py @@ -1,4 +1,4 @@ -from sqlalchemy import String, Text, Boolean, ForeignKey, Integer +from sqlalchemy import String, Text, Boolean, ForeignKey, Integer, func from sqlalchemy.orm import Mapped, mapped_column from datetime import datetime from typing import Optional @@ -21,4 +21,4 @@ class EventTemplate(Base): 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) + created_at: Mapped[datetime] = mapped_column(default=datetime.now, server_default=func.now()) diff --git a/frontend/src/components/calendar/CalendarPage.tsx b/frontend/src/components/calendar/CalendarPage.tsx index 92a562e..94bb260 100644 --- a/frontend/src/components/calendar/CalendarPage.tsx +++ b/frontend/src/components/calendar/CalendarPage.tsx @@ -297,7 +297,7 @@ export default function CalendarPage() { title: template.title, description: template.description || '', all_day: template.all_day, - calendar_id: template.calendar_id || 0, + calendar_id: template.calendar_id ?? undefined, location_id: template.location_id || undefined, is_starred: template.is_starred, recurrence_rule: template.recurrence_rule || undefined,