Skip to content

Commit

Permalink
Add ignore ids filter in draft entries query
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKhatri authored and subinasr committed Mar 29, 2024
1 parent a6347e5 commit a4e38d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion apps/assisted_tagging/filters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import django_filters

from .models import DraftEntry
from utils.graphene.filters import IDFilter, MultipleInputFilter
from utils.graphene.filters import (
IDFilter,
MultipleInputFilter,
IDListFilter,
)
from .enums import (
DraftEntryTypeEnum
)
Expand All @@ -10,8 +14,14 @@
class DraftEntryFilterSet(django_filters.FilterSet):
lead = IDFilter(field_name='lead')
draft_entry_types = MultipleInputFilter(DraftEntryTypeEnum, field_name='type')
ignore_ids = IDListFilter(method='filter_ignore_draft_ids', help_text='Ids are filtered out.')
is_discarded = django_filters.BooleanFilter()

class Meta:
model = DraftEntry
fields = ()

def filter_ignore_draft_ids(self, qs, _, value):
if value is None:
return qs
return qs.exclude(id__in=value)
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,7 @@ type AssistedTaggingPredictionType {

type AssistedTaggingQueryType {
draftEntry(id: ID!): DraftEntryType
draftEntries(lead: ID, draftEntryTypes: [DraftEntryTypeEnum!], isDiscarded: Boolean, page: Int = 1, pageSize: Int): DraftEntryListType
draftEntries(lead: ID, draftEntryTypes: [DraftEntryTypeEnum!], ignoreIds: [ID!], isDiscarded: Boolean, page: Int = 1, pageSize: Int): DraftEntryListType
}

type AssistedTaggingRootQueryType {
Expand Down

0 comments on commit a4e38d9

Please sign in to comment.