- New app/vikunja.py: get_tasks, create_task, update_task, delete_task - /todos page now reads from and writes to Vikunja (create, mark done, delete) - Auto-todos (clean build plate, filament low) post to Vikunja after DB commit - /api/todos router proxies to Vikunja - .env.install: VIKUNJA_URL, VIKUNJA_API_TOKEN, VIKUNJA_PROJECT_ID Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
503 B
Python
25 lines
503 B
Python
from fastapi import APIRouter
|
|
from app.vikunja import create_task, delete_task, get_tasks, update_task
|
|
|
|
router = APIRouter(prefix="/todos", tags=["todos"])
|
|
|
|
|
|
@router.get("/")
|
|
def list_todos():
|
|
return get_tasks()
|
|
|
|
|
|
@router.post("/")
|
|
def create_todo(body: dict):
|
|
return create_task(body.get("title", ""))
|
|
|
|
|
|
@router.post("/{task_id}")
|
|
def update_todo(task_id: int, body: dict):
|
|
update_task(task_id, **body)
|
|
|
|
|
|
@router.delete("/{task_id}")
|
|
def delete_todo(task_id: int):
|
|
delete_task(task_id)
|