support-organizer/backend/fgo_request_manager/routes/requests/base.py
Firq 03901e1d12
All checks were successful
/ build:package (push) Successful in 11s
/ backend-pylint (push) Successful in 21s
updated package to conform to pylint
2023-12-21 17:11:47 +01:00

23 lines
733 B
Python

from flask.views import MethodView
from ...database import Database
from ...models.requests import RequestStatus
from ...models.requestentry import RequestDatabaseEntry
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, RequestDatabaseEntry(many=True), description="Successful operation")
def get(self):
db_data = db.at("requests").read()
response = []
for value in db_data.values():
value.update({
"status": RequestStatus(value["status"])
})
response.append(value)
print(response)
return response