19 lines
558 B
Python
19 lines
558 B
Python
from flask.views import MethodView
|
|
|
|
from database import Database
|
|
from models.requests import RequestsAll
|
|
from . import routes_requests as blp
|
|
|
|
db = Database.get_instance().db
|
|
|
|
@blp.route("/all")
|
|
class AllRequests(MethodView):
|
|
@blp.doc(summary="Returns all requests")
|
|
@blp.response(200, RequestsAll(many=True), description="Successful operation")
|
|
def get(self):
|
|
db_data = db.at("requests").read()
|
|
response = []
|
|
for key, value in db_data.items():
|
|
response.append({"uuid": key, **value})
|
|
return response
|