NoteServicesAPI / app /api /notes /notes_delete.py
bichnhan2701's picture
Add delete note
cddfa37
raw
history blame contribute delete
445 Bytes
from fastapi import APIRouter, HTTPException
from app.services.note_store import get_note, delete_note
router = APIRouter(prefix="/notes", tags=["notes"])
@router.delete("/{note_id}")
def delete_note_api(note_id: str):
note = get_note(note_id)
if not note:
raise HTTPException(status_code=404, detail="Note not found")
delete_note(note_id)
return {
"note_id": note_id,
"deleted": True
}