-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jairo Matos Da Rocha
committed
Sep 30, 2024
1 parent
f0827ba
commit 7b43d6b
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |