Fix QA review warnings: model server_default, calendar_id coercion
- EventTemplate model: add server_default=func.now() to created_at to match migration 011 and prevent autogenerate drift - CalendarPage: use nullish coalescing for template calendar_id instead of || 0 which produced an invalid falsy ID Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f64e181fbe
commit
27003374e3
@ -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 sqlalchemy.orm import Mapped, mapped_column
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -21,4 +21,4 @@ class EventTemplate(Base):
|
|||||||
Integer, ForeignKey("locations.id", ondelete="SET NULL"), nullable=True
|
Integer, ForeignKey("locations.id", ondelete="SET NULL"), nullable=True
|
||||||
)
|
)
|
||||||
is_starred: Mapped[bool] = mapped_column(Boolean, default=False)
|
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())
|
||||||
|
|||||||
@ -297,7 +297,7 @@ export default function CalendarPage() {
|
|||||||
title: template.title,
|
title: template.title,
|
||||||
description: template.description || '',
|
description: template.description || '',
|
||||||
all_day: template.all_day,
|
all_day: template.all_day,
|
||||||
calendar_id: template.calendar_id || 0,
|
calendar_id: template.calendar_id ?? undefined,
|
||||||
location_id: template.location_id || undefined,
|
location_id: template.location_id || undefined,
|
||||||
is_starred: template.is_starred,
|
is_starred: template.is_starred,
|
||||||
recurrence_rule: template.recurrence_rule || undefined,
|
recurrence_rule: template.recurrence_rule || undefined,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user