35 lines
882 B
Python
35 lines
882 B
Python
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"
|
|
]
|
|
} |