diff --git a/apps/hadis/docs.py b/apps/hadis/docs.py index 6f86836..b8c63ae 100644 --- a/apps/hadis/docs.py +++ b/apps/hadis/docs.py @@ -841,12 +841,13 @@ hadis_info_swagger = swagger_auto_schema( status.HTTP_200_OK: openapi.Response( description="Hadis database statistics", examples={ - "application/json": { - "category_count": 25, - "reference_count": 150, - "bookmark_count": 75, - "narrator_count": 200 - } + "application/json":{ + "hadis_count": 65, + "category_count": 67, + "reference_count": 1, + "bookmark_count": 0, + "narrator_count": 8 + } } ), status.HTTP_500_INTERNAL_SERVER_ERROR: openapi.Response( diff --git a/apps/hadis/views/info.py b/apps/hadis/views/info.py index b5419a9..1c7b480 100644 --- a/apps/hadis/views/info.py +++ b/apps/hadis/views/info.py @@ -2,7 +2,8 @@ from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status -from ..models import HadisSect, BookReference, Transmitters + +from ..models import HadisSect, BookReference, Transmitters ,Hadis ,HadisCategory from ..docs import hadis_info_swagger from apps.bookmark.models import Bookmark @@ -14,7 +15,8 @@ class HadisInfoView(APIView): @hadis_info_swagger def get(self, request, *args, **kwargs): - category_count = HadisSect.objects.filter(is_active=True).count() + hadis_count = Hadis.objects.all().count() + category_count = HadisCategory.objects.all().count() reference_count = BookReference.objects.count() bookmark_count = Bookmark.objects.filter( service=Bookmark.ServiceChoices.HADITH, @@ -23,6 +25,7 @@ class HadisInfoView(APIView): narrator_count = Transmitters.objects.count() data = { + 'hadis_count':hadis_count, 'category_count': category_count, 'reference_count': reference_count, 'bookmark_count': bookmark_count,