[WIP] Library REST API
This commit is contained in:
23
app/routes/api/library/delete.py
Normal file
23
app/routes/api/library/delete.py
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
Reference in New Issue
Block a user