Skip to content

Commit

Permalink
Merge pull request #1526 from the-deep/fix/add-field-on-leadattachmen…
Browse files Browse the repository at this point in the history
…t-filter

OCR filter
  • Loading branch information
AdityaKhatri authored Dec 5, 2024
2 parents c028b99 + 9d48089 commit 1dd8a6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apps/lead/filter_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,17 @@ 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 +575,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 1dd8a6c

Please sign in to comment.