added vegetation

This commit is contained in:
2026-06-23 13:57:33 +03:00
parent 0c9fc22d22
commit c7435955c3
32 changed files with 336 additions and 15 deletions
+12 -1
View File
@@ -1,6 +1,16 @@
from fastapi import APIRouter
from app.routers import antenna, buildings, coverage, jobs, landcover, link, terrain, viewshed
from app.routers import (
antenna,
buildings,
coverage,
jobs,
landcover,
link,
status,
terrain,
viewshed,
)
api_router = APIRouter()
api_router.include_router(terrain.router, prefix="/terrain", tags=["terrain"])
@@ -11,3 +21,4 @@ api_router.include_router(coverage.router, prefix="/coverage", tags=["coverage"]
api_router.include_router(link.router, prefix="/link", tags=["link"])
api_router.include_router(antenna.router, prefix="/antenna", tags=["antenna"])
api_router.include_router(jobs.router, prefix="/jobs", tags=["jobs"])
api_router.include_router(status.router, prefix="/status", tags=["status"])
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -1
View File
@@ -5,6 +5,12 @@ from fastapi import HTTPException, status
T = TypeVar("T")
ERROR_CODES = {
"DemNotConfiguredError": "DEM_NOT_CONFIGURED",
"LandcoverNotConfiguredError": "LANDCOVER_NOT_CONFIGURED",
"RasterNotConfiguredError": "RASTER_NOT_CONFIGURED",
}
def as_501(call: Callable[[], T]) -> T:
try:
@@ -12,5 +18,8 @@ def as_501(call: Callable[[], T]) -> T:
except NotImplementedError as exc:
raise HTTPException(
status_code=status.HTTP_501_NOT_IMPLEMENTED,
detail=str(exc),
detail={
"code": ERROR_CODES.get(type(exc).__name__, "NOT_IMPLEMENTED"),
"detail": str(exc),
},
) from exc
+4 -1
View File
@@ -10,5 +10,8 @@ router = APIRouter()
def read(job_id: str) -> JobResponse:
job = get_job(job_id)
if job is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Job not found")
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail={"code": "JOB_NOT_FOUND", "detail": "Job not found"},
)
return job
+15
View File
@@ -0,0 +1,15 @@
from typing import Annotated
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.deps import get_db
from app.models.status import DataStatusResponse
from app.services import status as status_service
router = APIRouter()
@router.get("/data", response_model=DataStatusResponse)
def data_status(db: Annotated[Session, Depends(get_db)]) -> DataStatusResponse:
return status_service.data_status(db)