From e87804f455331375c92df3498925249d1b007af9 Mon Sep 17 00:00:00 2001 From: rup-narayan-rajbanshi Date: Fri, 27 Sep 2024 13:53:37 +0545 Subject: [PATCH] Remove rest api for Lead preview. --- apps/lead/serializers.py | 23 ----------------------- apps/lead/views.py | 10 ---------- deep/urls.py | 3 --- 3 files changed, 36 deletions(-) diff --git a/apps/lead/serializers.py b/apps/lead/serializers.py index 0267122691..7f1cce58fd 100644 --- a/apps/lead/serializers.py +++ b/apps/lead/serializers.py @@ -304,29 +304,6 @@ class Meta: fields = ('id', 'file',) -class LeadPreviewSerializer(RemoveNullFieldsMixin, - DynamicFieldsMixin, serializers.ModelSerializer): - """ - Serializer for lead preview - """ - - text = serializers.CharField(source='leadpreview.text_extract', - read_only=True) - images = LeadPreviewAttachmentSerializer(many=True, read_only=True) - classified_doc_id = serializers.IntegerField( - source='leadpreview.classified_doc_id', - read_only=True, - ) - preview_id = serializers.IntegerField( - source='leadpreview.pk', - read_only=True, - ) - - class Meta: - model = Lead - fields = ('id', 'preview_id', 'text', 'images', 'classified_doc_id') - - class LeadGroupSerializer(RemoveNullFieldsMixin, DynamicFieldsMixin, UserResourceSerializer): leads = LeadSerializer(source='lead_set', diff --git a/apps/lead/views.py b/apps/lead/views.py index 1e85ad6bfa..db25caa0f7 100644 --- a/apps/lead/views.py +++ b/apps/lead/views.py @@ -55,7 +55,6 @@ LeadGroupSerializer, SimpleLeadGroupSerializer, LeadSerializer, - LeadPreviewSerializer, check_if_url_exists, LeadOptionsSerializer, LeadOptionsBodySerializer, @@ -237,15 +236,6 @@ def leads_filter(self, request, version=None): return response -class LeadPreviewViewSet(viewsets.ReadOnlyModelViewSet): - serializer_class = LeadPreviewSerializer - permission_classes = [permissions.IsAuthenticated, - ModifyPermission] - - def get_queryset(self): - return Lead.get_for(self.request.user) - - class LeadOptionsView(views.APIView): """ Options for various attributes related to lead diff --git a/deep/urls.py b/deep/urls.py index 402feebce6..ab0b575e45 100644 --- a/deep/urls.py +++ b/deep/urls.py @@ -75,7 +75,6 @@ from lead.views import ( LeadGroupViewSet, LeadViewSet, - LeadPreviewViewSet, LeadOptionsView, LeadExtractionTriggerView, LeadWebsiteFetch, @@ -254,8 +253,6 @@ basename='lead_group') router.register(r'leads', LeadViewSet, basename='lead') -router.register(r'lead-previews', LeadPreviewViewSet, - basename='lead_preview') # Questionnaire routers router.register(r'questionnaires/(?P\d+)/questions',