-
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
1 parent
d4b745a
commit 5c07a3a
Showing
10 changed files
with
26 additions
and
6 deletions.
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 @@ | ||
__pycache__ |
Binary file not shown.
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,11 +1,10 @@ | ||
from fastapi import FastAPI | ||
from src.application.routers import users | ||
|
||
from src.domain.user.user_entity import User, UserDTO | ||
|
||
app = FastAPI() | ||
app.include_router(users.router) | ||
|
||
|
||
@app.post("/") | ||
async def users(user_props: UserDTO): | ||
user = User(user_props) | ||
return {"user": user} | ||
@app.get("/") | ||
async def home(): | ||
return {"status": "ok"} |
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 |
---|---|---|
|
@@ -36,5 +36,6 @@ colocar as depedencias da dependecia no requirements | |
|
||
pip install -r requirements.txt | ||
|
||
uvicorn main:app --reload | ||
|
||
|
Binary file not shown.
Empty file.
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,19 @@ | ||
from fastapi import APIRouter, HTTPException | ||
from src.domain.user.user_entity import User, UserDTO | ||
|
||
|
||
router = APIRouter( | ||
prefix="/users", | ||
tags=["users"], | ||
# TODO dependencies=[Depends(get_token_header)], | ||
responses={404: {"description": "Não encontrado"}}, | ||
) | ||
|
||
@router.post("/", description="Api to save user", status_code=201) | ||
async def save_user(user_props: UserDTO): | ||
user = User(user_props) | ||
return {"user": user} | ||
|
||
@router.get("/", description="Api to list users") | ||
async def users(): | ||
return [User(user_props=UserDTO(age=0))] |
Binary file not shown.
Binary file not shown.
Binary file not shown.