support-organizer/backend/fgo_request_manager/routes/health.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

21 lines
668 B
Python

from datetime import datetime
from flask.views import MethodView
from ..app import Application
from ..models.interface import HealthGet, HealthStatus
from . import routes as blp
APP = Application.get_instance()
@blp.route("/health")
class ApiVersion(MethodView):
@blp.doc(summary="Returns the status and alive-time of the server")
@blp.response(200, HealthGet, description="Successful operation")
def get(self):
response = {
"alive_since": datetime.strftime(APP.alive_since, "%d.%m.%Y %H:%M:%S"),
"alive_for": str(datetime.now() - APP.alive_since),
"status": HealthStatus.OK
}
return response