Auto-update: Tue Jul 23 22:43:59 PDT 2024

This commit is contained in:
sanj 2024-07-23 22:43:59 -07:00
parent 99e2729fde
commit 812948479c
2 changed files with 5 additions and 2 deletions

View file

@ -489,7 +489,10 @@ class Location(BaseModel):
datetime: lambda dt: dt.isoformat(),
}
def model_dump(self):
data = self.dict()
data["datetime"] = self.datetime.isoformat() if self.datetime else None
return data
class Geocoder:

View file

@ -548,11 +548,11 @@ async def get_last_location_endpoint() -> JSONResponse:
if this_location:
location_dict = this_location.model_dump()
location_dict["datetime"] = this_location.datetime.isoformat()
return JSONResponse(content=location_dict)
else:
raise HTTPException(status_code=404, detail="No location found before the specified datetime")
@gis.get("/locate/{datetime_str}", response_model=List[Location])
async def get_locate(datetime_str: str, all: bool = False):
try: