Skip to content

Commit

Permalink
Add field in lead attachment filter
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Dec 5, 2024
1 parent 8c1c56b commit 88afdb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions apps/lead/filter_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,15 @@ 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_leadattachment_created_entries = django_filters.BooleanFilter(method='filter_exclude_leadattachment_created_entries')

class Meta:
model = LeadPreviewAttachment
fields = [
'lead',
'page_number',
'exclude_attachment_ids',
'exclude_leadattachment_created_entries'
]

def filter_exclude_lead_attachment_ids(self, qs, _, value):
Expand All @@ -571,6 +573,12 @@ def filter_exclude_lead_attachment_ids(self, qs, _, value):
return qs
return qs

def filter_exclude_leadattachment_created_entries(self, qs, _, value):
if value:
qs = qs.exclude(lead__entry__isnull=value)
return qs
return qs


LeadsFilterDataType, LeadsFilterDataInputType = generate_type_for_filter_set(
LeadGQFilterSet,
Expand Down
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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!], excludeLeadattachmentCreatedEntries: 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
Expand Down

0 comments on commit 88afdb2

Please sign in to comment.