mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
basic statistics
This commit is contained in:
@@ -194,3 +194,14 @@ class SearchAutoCompleteView(APIView):
|
||||
return Response(index.autocomplete(self.ix, term, limit))
|
||||
else:
|
||||
return Response([])
|
||||
|
||||
|
||||
class StatisticsView(APIView):
|
||||
|
||||
permission_classes = (IsAuthenticated,)
|
||||
|
||||
def get(self, request, format=None):
|
||||
return Response({
|
||||
'documents_total': Document.objects.all().count(),
|
||||
'documents_inbox': Document.objects.filter(tags__is_inbox_tag=True).distinct().count()
|
||||
})
|
||||
|
@@ -14,7 +14,8 @@ from documents.views import (
|
||||
DocumentTypeViewSet,
|
||||
SearchView,
|
||||
IndexView,
|
||||
SearchAutoCompleteView
|
||||
SearchAutoCompleteView,
|
||||
StatisticsView
|
||||
)
|
||||
|
||||
api_router = DefaultRouter()
|
||||
@@ -31,6 +32,7 @@ urlpatterns = [
|
||||
url(r"^api/auth/",include(('rest_framework.urls', 'rest_framework'), namespace="rest_framework")),
|
||||
url(r"^api/search/autocomplete/", SearchAutoCompleteView.as_view(), name="autocomplete"),
|
||||
url(r"^api/search/", SearchView.as_view(), name="search"),
|
||||
url(r"^api/statistics/", StatisticsView.as_view(), name="statistics"),
|
||||
url(r"^api/token/", views.obtain_auth_token), url(r"^api/", include((api_router.urls, 'drf'), namespace="drf")),
|
||||
|
||||
# Favicon
|
||||
|
Reference in New Issue
Block a user