Skip to content

Commit

Permalink
tvi router
Browse files Browse the repository at this point in the history
  • Loading branch information
Jairo Matos Da Rocha committed Sep 30, 2024
1 parent f0827ba commit 7b43d6b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions app/api/tvi.py
Original file line number Diff line number Diff line change
@@ -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})
3 changes: 2 additions & 1 deletion app/router.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7b43d6b

Please sign in to comment.