Skip to content

Commit

Permalink
Start adding /info endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogsilva committed Jun 11, 2024
1 parent 6c6842c commit a8953e1
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion arpav_ppcv/webapp/api_v2/routers/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import importlib.metadata
import logging
import os
from typing import Annotated

from fastapi import APIRouter
import sqlmodel
from fastapi import (
APIRouter,
Depends,
)

from .... import database
from ... import dependencies
from ..schemas.base import AppInformation


Expand All @@ -18,3 +25,16 @@ async def get_app_info():
"version": importlib.metadata.version("arpav_ppcv_backend"),
"git_commit": os.getenv("GIT_COMMIT", "unknown"),
}


@router.get("/info/{longitude}/{latitude")
def get_coordinates_info(
db_session: Annotated[sqlmodel.Session, Depends(dependencies.get_db_session)],
longitude: float,
latitude: float,
):
"""Return information about a point location."""
municipality = database.get_municipality_by_coordinates(
db_session, longitude, latitude
)
logger.debug(f"{municipality=}")

0 comments on commit a8953e1

Please sign in to comment.