35 lines
737 B
Python
35 lines
737 B
Python
from fastapi import APIRouter, HTTPException
|
|
import uuid
|
|
|
|
todos = [] # In-memory storage
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/todos")
|
|
async def create_todo(
|
|
title: str = "New Todo",
|
|
description: str = "Todo description",
|
|
priority: int = 1
|
|
):
|
|
"""Create a new todo item"""
|
|
todo_id = str(uuid.uuid4())
|
|
|
|
todo = {
|
|
"id": todo_id,
|
|
"title": title,
|
|
"description": description,
|
|
"priority": priority,
|
|
"completed": False
|
|
}
|
|
|
|
todos.append(todo)
|
|
|
|
return {
|
|
"message": "Todo created successfully",
|
|
"todo_id": todo_id,
|
|
"title": title,
|
|
"next_steps": [
|
|
"Add more todos",
|
|
"Mark as complete when done"
|
|
]
|
|
} |