Imporve gateway auth for all services
This commit is contained in:
@@ -6,10 +6,9 @@ from typing import List, Optional, Dict, Any
|
||||
from datetime import datetime, date
|
||||
import structlog
|
||||
|
||||
from app.schemas.weather import (
|
||||
from app.schemas.external import (
|
||||
WeatherDataResponse,
|
||||
WeatherForecastResponse,
|
||||
WeatherSummaryResponse
|
||||
WeatherForecastResponse
|
||||
)
|
||||
from app.services.weather_service import WeatherService
|
||||
from app.services.messaging import publish_weather_updated
|
||||
@@ -136,35 +135,6 @@ async def get_weather_history(
|
||||
logger.error("Failed to get weather history", error=str(e))
|
||||
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
||||
|
||||
@router.get("/summary", response_model=WeatherSummaryResponse)
|
||||
async def get_weather_summary(
|
||||
location_id: Optional[str] = Query(None, description="Location ID"),
|
||||
days: int = Query(30, description="Number of days to summarize"),
|
||||
tenant_id: str = Depends(get_current_tenant_id_dep),
|
||||
current_user: Dict[str, Any] = Depends(get_current_user_dep),
|
||||
):
|
||||
"""Get weather summary for tenant's location"""
|
||||
try:
|
||||
logger.debug("Getting weather summary",
|
||||
location_id=location_id,
|
||||
days=days,
|
||||
tenant_id=tenant_id)
|
||||
|
||||
weather_service = WeatherService()
|
||||
|
||||
# If no location_id provided, use tenant's default location
|
||||
if not location_id:
|
||||
# This would typically fetch from tenant service
|
||||
location_id = tenant_id # Simplified for example
|
||||
|
||||
summary = await weather_service.get_weather_summary(location_id, days)
|
||||
|
||||
return summary
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Failed to get weather summary", error=str(e))
|
||||
raise HTTPException(status_code=500, detail=f"Internal server error: {str(e)}")
|
||||
|
||||
@router.post("/sync")
|
||||
async def sync_weather_data(
|
||||
background_tasks: BackgroundTasks,
|
||||
|
||||
Reference in New Issue
Block a user