From dec28cec02d95343c5aff9001f0f3fdb0bad849d Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Sun, 1 Aug 2021 17:22:45 -0700 Subject: [PATCH 1/2] Added ApiStatusView for the AGAGD. --- agagd/agagd/urls.py | 2 ++ agagd/agagd_core/urls.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/agagd/agagd/urls.py b/agagd/agagd/urls.py index 717768eb..eb822910 100644 --- a/agagd/agagd/urls.py +++ b/agagd/agagd/urls.py @@ -1,5 +1,6 @@ from agagd_core import urls as beta_urls from agagd_core.views import core as agagd_views +from agagd_core.views.beta.api import ApiStatusView from agagd_core.views.core import InformationPageView, QualificationsPageView from django.conf import settings from django.conf.urls import include, url @@ -8,6 +9,7 @@ from django.views.generic import RedirectView urlpatterns = [ + path("api/status/", ApiStatusView.as_view(), name="api_status_view"), url(r"^$", agagd_views.index, name="index"), url(r".php$", RedirectView.as_view(url=reverse_lazy("index"))), url(r"^search/$", agagd_views.search, name="search"), diff --git a/agagd/agagd_core/urls.py b/agagd/agagd_core/urls.py index c27c6fcf..b20deaab 100644 --- a/agagd/agagd_core/urls.py +++ b/agagd/agagd_core/urls.py @@ -1,4 +1,5 @@ # AGAGD Beta Imports +from agagd_core.views.beta.api import ApiStatusView from agagd_core.views.beta.core import ( list_all_players, list_all_tournaments, @@ -17,6 +18,7 @@ # fmt: off beta_patterns = ([ path('', frontpage, name='index'), + path('api/status/', ApiStatusView.as_view(), name='beta_api_status'), path('players/', list_all_players, name='players_list'), path('players//', players_profile, name='players_profile'), path('information/', InformationView.as_view(), name='ratings_overview'), @@ -25,4 +27,4 @@ path('tournaments/', list_all_tournaments, name='tournaments_list'), path('tournaments//', tournament_detail, name='tournament_detail'), path('qualifications/', QualificationsView.as_view(), name='qualifications_overview') - ], 'beta') +], 'beta') From 13859a7f6a4257dc4a86844b4bd68758ac676e4c Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Sun, 1 Aug 2021 17:28:49 -0700 Subject: [PATCH 2/2] Added ApiStatusView with health_status message. --- agagd/agagd_core/views/beta/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 agagd/agagd_core/views/beta/api.py diff --git a/agagd/agagd_core/views/beta/api.py b/agagd/agagd_core/views/beta/api.py new file mode 100644 index 00000000..3c2975e3 --- /dev/null +++ b/agagd/agagd_core/views/beta/api.py @@ -0,0 +1,9 @@ +from agagd_core.json_response import JsonResponse +from django.http import HttpResponse +from django.views import View + + +class ApiStatusView(View): + def get(self, request): + response = {"health_status_code": 200, "health_status": "The AGAGD is running."} + return JsonResponse(response)