diff --git a/sijapi/classes.py b/sijapi/classes.py index ed7e5fd..6098ce6 100644 --- a/sijapi/classes.py +++ b/sijapi/classes.py @@ -1176,7 +1176,6 @@ class Location(BaseModel): } populate_by_name = True - class Geocoder: def __init__(self, named_locs: Union[str, Path] = None, cache_file: Union[str, Path] = 'timezone_cache.json'): self.tf = TimezoneFinder() diff --git a/sijapi/routers/gis.py b/sijapi/routers/gis.py index e7b91e8..d00ce14 100644 --- a/sijapi/routers/gis.py +++ b/sijapi/routers/gis.py @@ -528,12 +528,13 @@ async def post_locate_endpoint(locations: Union[Location, List[Location]]): return {"message": "Locations and weather updated", "results": responses} + @gis.get("/locate", response_model=Location) async def get_last_location_endpoint() -> JSONResponse: this_location = await get_last_location() if this_location: - location_dict = this_location.model_dump() + location_dict = this_location.model_dump(mode='json') return JSONResponse(content=location_dict) else: raise HTTPException(status_code=404, detail="No location found before the specified datetime")