Files
BiblioGame/app/routes/api/library/delete.py
2026-02-15 11:32:33 +01:00

23 lines
593 B
Python

from flask import request
from sqlalchemy.exc import NoResultFound
from .blueprint import api_library
from ....controller import LibraryController
from ....schema.library.library import Library
import logging
logger = logging.getLogger(__name__)
@api_library.route("/<_id>", methods=["DELETE"])
def delete_library(_id):
try: # TODO: function
controller = LibraryController(_id)
except NoResultFound as e:
logger.debug({e})
return { "status": "error", "error": "Library not found" }, 404
controller.delete()
return { "status": "ok" }, 201