- Add weather router with OpenWeatherMap integration and 1-hour cache - Add is_starred column to calendar events with countdown widget - Add weather_city setting with Settings page input - Replace people/locations stats with open todos count + weather card - Add quick-add dropdown (event/todo/reminder) to dashboard header - Make CalendarWidget events single-line thin rows - Add rain warnings to smart briefing when chance > 40% - Invalidate dashboard/upcoming queries on form mutations - Migration 004: is_starred + weather_city columns Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
1.3 KiB
Python
26 lines
1.3 KiB
Python
from sqlalchemy import String, Text, Boolean, Integer, ForeignKey, func
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from app.database import Base
|
|
|
|
|
|
class CalendarEvent(Base):
|
|
__tablename__ = "calendar_events"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
description: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
start_datetime: Mapped[datetime] = mapped_column(nullable=False)
|
|
end_datetime: Mapped[datetime] = mapped_column(nullable=False)
|
|
all_day: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
color: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
|
|
location_id: Mapped[Optional[int]] = mapped_column(Integer, ForeignKey("locations.id"), nullable=True)
|
|
recurrence_rule: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
|
is_starred: Mapped[bool] = mapped_column(Boolean, default=False, server_default="false")
|
|
created_at: Mapped[datetime] = mapped_column(default=func.now())
|
|
updated_at: Mapped[datetime] = mapped_column(default=func.now(), onupdate=func.now())
|
|
|
|
# Relationships
|
|
location: Mapped[Optional["Location"]] = relationship(back_populates="events")
|