mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-14 18:46:52 +01:00
basic statistics
This commit is contained in:
parent
69a62fbf64
commit
d67eacdd6f
4 changed files with 33 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue