From e85fa910aa92d7d76f7f8a64a1138ea0f84c1e37 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 26 Aug 2022 07:20:30 +0100 Subject: [PATCH] Remove API view folder and files --- core/api/views/__init__.py | 0 core/api/views/threshold.py | 67 ------------------------------------- 2 files changed, 67 deletions(-) delete mode 100644 core/api/views/__init__.py delete mode 100644 core/api/views/threshold.py diff --git a/core/api/views/__init__.py b/core/api/views/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/core/api/views/threshold.py b/core/api/views/threshold.py deleted file mode 100644 index d4453d7..0000000 --- a/core/api/views/threshold.py +++ /dev/null @@ -1,67 +0,0 @@ -import logging - -from django.contrib.auth.mixins import LoginRequiredMixin -from django.http import HttpResponse, JsonResponse -from rest_framework.parsers import FormParser -from rest_framework.views import APIView - -from core.lib.threshold import annotate_online, get_chans, get_users - -logger = logging.getLogger(__name__) - - -class ThresholdChans(LoginRequiredMixin, APIView): - parser_classes = [FormParser] - plan_name = "drilldown" - - def post(self, request): - if not request.user.has_plan(self.plan_name): - return JsonResponse({"success": False}) - if "net" not in request.data: - return JsonResponse({"success": False}) - if "query" not in request.data: - return JsonResponse({"success": False}) - net = request.data["net"] - query = request.data["query"] - channels = get_chans(net, [query]) - if not channels: - return HttpResponse("") - channels_human = ", ".join(channels) - return HttpResponse(channels_human) - - -class ThresholdUsers(LoginRequiredMixin, APIView): - parser_classes = [FormParser] - plan_name = "drilldown" - - def post(self, request): - if not request.user.has_plan(self.plan_name): - return JsonResponse({"success": False}) - if "net" not in request.data: - return JsonResponse({"success": False}) - if "query" not in request.data: - return JsonResponse({"success": False}) - net = request.data["net"] - query = request.data["query"] - users = get_users(net, [query]) - if not users: - return HttpResponse("") - users_human = ", ".join(users) - return HttpResponse(users_human) - - -class ThresholdOnline(LoginRequiredMixin, APIView): - parser_classes = [FormParser] - plan_name = "drilldown" - - def post(self, request): - if not request.user.has_plan(self.plan_name): - return JsonResponse({"success": False}) - if "net" not in request.data: - return JsonResponse({"success": False}) - if "query" not in request.data: - return JsonResponse({"success": False}) - net = request.data["net"] - query = request.data["query"] - online_info = annotate_online(net, query) - return JsonResponse(online_info)