diff --git a/apps/lead/filter_set.py b/apps/lead/filter_set.py index da1c0d4c11..d312d85ca1 100644 --- a/apps/lead/filter_set.py +++ b/apps/lead/filter_set.py @@ -556,6 +556,7 @@ def filter_title(self, qs, name, value): class LeadPreviewAttachmentGQFilterSet(UserResourceGqlFilterSet): type = MultipleInputFilter(LeadPreviewAttachmentTypeEnum, field_name='type') exclude_attachment_ids = IDListFilter(method='filter_exclude_lead_attachment_ids') + exclude_lead_with_no_entries = django_filters.BooleanFilter(method='filter_exclude_with_entries') class Meta: model = LeadPreviewAttachment @@ -563,6 +564,7 @@ class Meta: 'lead', 'page_number', 'exclude_attachment_ids', + 'exclude_lead_with_no_entries' ] def filter_exclude_lead_attachment_ids(self, qs, _, value): @@ -571,6 +573,12 @@ def filter_exclude_lead_attachment_ids(self, qs, _, value): return qs return qs + def filter_exclude_lead_with_no_entries(self, qs, _, value): + if value: + qs = qs.exclude(lead__entry__isnull=False) + return qs + return qs + LeadsFilterDataType, LeadsFilterDataInputType = generate_type_for_filter_set( LeadGQFilterSet, diff --git a/schema.graphql b/schema.graphql index faee0e9414..9792d0067d 100644 --- a/schema.graphql +++ b/schema.graphql @@ -5397,7 +5397,7 @@ type ProjectDetailType { leadGroups(createdAt: DateTime, createdAtGte: DateTime, createdAtLte: DateTime, modifiedAt: DateTime, modifiedAtGte: DateTime, modifiedAtLte: DateTime, createdBy: [ID!], modifiedBy: [ID!], search: String, page: Int = 1, ordering: String, pageSize: Int): LeadGroupListType emmEntities(name: String, page: Int = 1, ordering: String, pageSize: Int): EmmEntityListType leadEmmTriggers(lead: ID, emmKeyword: String, emmRiskFactor: String, count: Int, page: Int = 1, ordering: String, pageSize: Int): LeadEmmTriggerListType - leadPreviewAttachments(lead: ID, pageNumber: Int, excludeAttachmentIds: [ID!], createdAt: DateTime, createdAtGte: DateTime, createdAtLte: DateTime, modifiedAt: DateTime, modifiedAtGte: DateTime, modifiedAtLte: DateTime, createdBy: [ID!], modifiedBy: [ID!], type: [LeadPreviewAttachmentTypeEnum!], page: Int = 1, ordering: String, pageSize: Int): LeadPreviewAttachmentListType + leadPreviewAttachments(lead: ID, pageNumber: Int, excludeAttachmentIds: [ID!], excludeLeadWithNoEntries: Boolean, createdAt: DateTime, createdAtGte: DateTime, createdAtLte: DateTime, modifiedAt: DateTime, modifiedAtGte: DateTime, modifiedAtLte: DateTime, createdBy: [ID!], modifiedBy: [ID!], type: [LeadPreviewAttachmentTypeEnum!], page: Int = 1, ordering: String, pageSize: Int): LeadPreviewAttachmentListType emmKeywords: [EmmKeyWordType!] emmRiskFactors: [EmmKeyRiskFactorType!] userSavedLeadFilter: UserSavedLeadFilterType