Update code in endpoints/rojects.post.py
This commit is contained in:
parent
2b19cf33dd
commit
c6dfe19b14
35
endpoints/rojects.post.py
Normal file
35
endpoints/rojects.post.py
Normal file
@ -0,0 +1,35 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
import uuid
|
||||
|
||||
projects = [] # In-memory storage
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/projects")
|
||||
async def create_project(
|
||||
name: str = "My Project",
|
||||
description: str = "Project description",
|
||||
owner: str = "default_owner"
|
||||
):
|
||||
"""Create new project endpoint"""
|
||||
if any(p["name"] == name for p in projects):
|
||||
raise HTTPException(status_code=400, detail="Project name already exists")
|
||||
|
||||
project_id = str(uuid.uuid4())
|
||||
projects.append({
|
||||
"id": project_id,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"owner": owner,
|
||||
"disabled": False
|
||||
})
|
||||
|
||||
return {
|
||||
"message": "Project created successfully",
|
||||
"project_id": project_id,
|
||||
"name": name,
|
||||
"next_steps": [
|
||||
"Add team members",
|
||||
"Configure project settings"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user