diff --git a/app/api/tvi.py b/app/api/tvi.py new file mode 100644 index 0000000..5040cb7 --- /dev/null +++ b/app/api/tvi.py @@ -0,0 +1,35 @@ +from fastapi.responses import JSONResponse +import geopandas as gpd +import ee + +from app.models.oauth2 import UserInfo +from app.oauth2 import has_role +import os + +from fastapi import APIRouter, Depends, HTTPException, Request, Query +from app.config import logger + +router = APIRouter() + + +@router.get("/public" ) +def public(): + return JSONResponse({"message": "public"}) + + + +@router.get("/privete" ) +async def privete( + request: Request, + user_data: UserInfo = Depends(has_role(['savegeom'])) # This should be a function that retrieves user data from the request. +): + """ Essa rota e privada e o usuario precisa da permição savegeom par acessar + + Args: + request (Request): Request do FastAPI + user_data (UserInfo, optional): Dados basico do usurio que pediu a rota + + Returns: + _type_: _description_ + """ + return JSONResponse({"message": "privete", "data": user_data}) \ No newline at end of file diff --git a/app/router.py b/app/router.py index 30bcbcf..773a6c8 100644 --- a/app/router.py +++ b/app/router.py @@ -1,10 +1,11 @@ -from .api import task, result, oauth2 +from .api import task, result, oauth2, tvi def created_routes(app): app.include_router(task.router, prefix="/api/task", tags=["Task Google Earth Engine"]) app.include_router(result.router, prefix="/api/result", tags=["Result Google Earth Engine"]) + app.include_router(tvi.routes, prefix="/api/tvi", tags=["TVI - Temporal Visual Inspection"]) app.include_router(oauth2.routes, prefix="/api/auth", tags=["Authentication"]) return app