backend-sxrb8t/endpoints/weather.get.py

13 lines
516 B
Python

from fastapi import APIRouter, Depends
from typing import List
from sqlalchemy.orm import Session
from core.database import get_db
from schemas.weather_forecast import WeatherForecastSchema
from helpers.weather_forecast_helpers import get_weather_forecasts
router = APIRouter()
@router.get("/weather", status_code=200, response_model=List[WeatherForecastSchema])
async def get_weather_forecasts_endpoint(db: Session = Depends(get_db)):
weather_forecasts = get_weather_forecasts(db)
return weather_forecasts