Fixed formatting and type definitions
This commit is contained in:
parent
bbe0df9546
commit
d97335e0c7
5 changed files with 112 additions and 65 deletions
|
|
@ -1,29 +1,28 @@
|
|||
from app.models.project import Project
|
||||
from fastapi import APIRouter
|
||||
from app.logic.project_logic import create, get_all, get_by_id, get_with_parent
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/projects",
|
||||
tags=["projects"]
|
||||
)
|
||||
from app.logic.project_logic import create, get_all, get_by_id, get_with_parent
|
||||
from app.models.project import Project
|
||||
|
||||
router = APIRouter(prefix="/projects", tags=["projects"])
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def get_default():
|
||||
return {"message": "Root for Projects API"}
|
||||
|
||||
|
||||
return {
|
||||
"message": "Root for Projects API"
|
||||
}
|
||||
|
||||
@router.get("/all")
|
||||
def get_all_projects(parent: int | None = None):
|
||||
if parent:
|
||||
return get_with_parent(parent)
|
||||
return get_all()
|
||||
|
||||
|
||||
|
||||
@router.get("/project/{project_id}")
|
||||
def get_project_by_id(project_id: int):
|
||||
return get_by_id(project_id)
|
||||
|
||||
|
||||
|
||||
@router.post("/")
|
||||
def create_project(project: Project):
|
||||
return create(project)
|
||||
return create(project)
|
||||
|
|
|
|||
Loading…
Reference in a new issue