Status API view

This commit is contained in:
Kumi 2021-10-24 16:47:51 +02:00
parent 8cbe5d5944
commit 78e0d06566
2 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,7 @@
from django.urls import path
from api.views import AvailabilityView
from api.views import AvailabilityView, StatusView
urlpatterns = [
path('availability/', AvailabilityView.as_view(), name="availability")
path('availability/', AvailabilityView.as_view(), name="availability"),
path('status/', AvailabilityView.as_view(), name="status"),
]

View file

@ -6,4 +6,8 @@ from buyer.models import Card
class AvailabilityView(View):
def get(self, request):
cards = len(Card.objects.filter(delivered__isnull=True))
return JsonResponse({"cards": cards})
return JsonResponse({"cards": cards})
class StatusView(View):
def get(self, request):
return JsonResponse({"status": "OK", "messages": []})