feat: Update endpoint project
This commit is contained in:
parent
a263a03e14
commit
0a767bbc65
@ -0,0 +1,14 @@
|
||||
@router.post("/projects", response_model=ProjectResponse, status_code=status.HTTP_201_CREATED)
|
||||
async def create_project(project: ProjectCreate, user: User = Depends(get_current_user), db: Session = Depends(get_db)):
|
||||
"""
|
||||
Create a new project.
|
||||
"""
|
||||
new_project = Project(
|
||||
name=project.name,
|
||||
description=project.description,
|
||||
owner_id=user.id
|
||||
)
|
||||
db.add(new_project)
|
||||
db.commit()
|
||||
db.refresh(new_project)
|
||||
return new_project
|
Loading…
x
Reference in New Issue
Block a user