Skip to content

feat: add api routes#1

Open
marcoslanabr00 wants to merge 1 commit into
mainfrom
feature/api-routes
Open

feat: add api routes#1
marcoslanabr00 wants to merge 1 commit into
mainfrom
feature/api-routes

Conversation

@marcoslanabr00
Copy link
Copy Markdown
Collaborator

Transformações das funções em endpoints na FastAPI

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds FastAPI routes for exposing existing product and stock service functions as API endpoints, and registers the router in the application.

Changes:

  • Adds product CRUD endpoints under /produtos.
  • Adds stock listing endpoint under /estoque.
  • Includes the new router in the FastAPI app.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/api/routers.py Defines API routes that delegate to product and stock service functions.
backend/api/app.py Registers the new router with the FastAPI application.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/api/routers.py


# POST - criar produto
@router.post("/produtos", response_model=Product)
Comment thread backend/api/routers.py
Comment on lines +54 to +61
@router.delete("/produtos/{produto_id}")
def delete_produto(produto_id: str):
deletado = deletar_produto(produto_id)

if not deletado:
raise HTTPException(status_code=404, detail="Produto não encontrado")

return {"success": True}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants