mirror of
https://github.com/Andre-Bzk/Rezept0r.git
synced 2026-11-15 09:33:05 +01:00
23 lines
605 B
Python
23 lines
605 B
Python
"""GET /api/history, DELETE /api/history/{id}"""
|
|
from fastapi import APIRouter, HTTPException
|
|
from app.services.history_service import get_all, delete_recipe
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/history")
|
|
async def get_history():
|
|
try:
|
|
return get_all()
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
@router.delete("/history/{history_id}")
|
|
async def delete_history_entry(history_id: int):
|
|
try:
|
|
delete_recipe(history_id)
|
|
return {"status": "ok"}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=str(e))
|