Coverage for backend / app / geolocation / routers.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-17 21:34 +0000

1from fastapi import APIRouter, Body, Depends 

2from sqlalchemy.orm import Session 

3 

4from app import models, database 

5from app.core import oauth2 

6from app.geolocation.geolocation import geocode_location 

7from app.data_tables.schemas import GeolocationOut 

8 

9router = APIRouter(prefix="/geolocation", tags=["geolocation"]) 

10 

11 

12@router.post("/", response_model=GeolocationOut) 

13def geolocate( 

14 string: str = Body(...), 

15 db: Session = Depends(database.get_db), 

16 _current_user: models.User = Depends(oauth2.get_current_user), 

17) -> models.Geolocation | None: 

18 return geocode_location(string, db)