Replace plain-text city input with geocoding search that resolves lat/lon coordinates for accurate OpenWeatherMap queries. Users can now search, see multiple results with state/country detail, and select the exact location. - Add GET /api/weather/search endpoint (OWM Geocoding API) - Add weather_lat/weather_lon columns to settings model + migration - Use lat/lon for weather API calls when available, fall back to city name - Replace settings text input with debounced search + dropdown selector - Show selected location as chip with clear button Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
20 lines
1.0 KiB
Python
20 lines
1.0 KiB
Python
from sqlalchemy import String, Integer, Float, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from datetime import datetime
|
|
from app.database import Base
|
|
|
|
|
|
class Settings(Base):
|
|
__tablename__ = "settings"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
pin_hash: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
accent_color: Mapped[str] = mapped_column(String(20), default="cyan")
|
|
upcoming_days: Mapped[int] = mapped_column(Integer, default=7)
|
|
preferred_name: Mapped[str | None] = mapped_column(String(100), nullable=True, default=None)
|
|
weather_city: Mapped[str | None] = mapped_column(String(100), nullable=True, default=None)
|
|
weather_lat: Mapped[float | None] = mapped_column(Float, nullable=True, default=None)
|
|
weather_lon: Mapped[float | None] = mapped_column(Float, nullable=True, default=None)
|
|
created_at: Mapped[datetime] = mapped_column(default=func.now())
|
|
updated_at: Mapped[datetime] = mapped_column(default=func.now(), onupdate=func.now())
|