Add missing GraphQL filters

This commit is contained in:
Jeremy Stretch 2025-03-06 14:52:33 -05:00
parent c369ac929d
commit 8894c35e84
10 changed files with 48 additions and 9 deletions

View File

@ -121,7 +121,7 @@ class CircuitGroupAssignmentFilter(
member_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = ( member_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )
member_type_id: ID | None = strawberry_django.filter_field() member_id: ID | None = strawberry_django.filter_field()
group: Annotated['CircuitGroupFilter', strawberry.lazy('circuits.graphql.filters')] | None = ( group: Annotated['CircuitGroupFilter', strawberry.lazy('circuits.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )

View File

@ -75,7 +75,9 @@ class ObjectChangeFilter(BaseFilterMixin):
) )
changed_object_type_id: ID | None = strawberry_django.filter_field() changed_object_type_id: ID | None = strawberry_django.filter_field()
changed_object_id: ID | None = strawberry_django.filter_field() changed_object_id: ID | None = strawberry_django.filter_field()
related_object_type_id: ID | None = strawberry_django.filter_field() related_object_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field()
)
related_object_id: ID | None = strawberry_django.filter_field() related_object_id: ID | None = strawberry_django.filter_field()
object_repr: FilterLookup[str] | None = strawberry_django.filter_field() object_repr: FilterLookup[str] | None = strawberry_django.filter_field()
prechange_data: Annotated['JSONFilter', strawberry.lazy('netbox.graphql.filter_lookups')] | None = ( prechange_data: Annotated['JSONFilter', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (

View File

@ -47,7 +47,6 @@ __all__ = (
'DeviceFilter', 'DeviceFilter',
'DeviceBayFilter', 'DeviceBayFilter',
'DeviceBayTemplateFilter', 'DeviceBayTemplateFilter',
'InventoryItemTemplateFilter',
'DeviceRoleFilter', 'DeviceRoleFilter',
'DeviceTypeFilter', 'DeviceTypeFilter',
'FrontPortFilter', 'FrontPortFilter',
@ -56,6 +55,7 @@ __all__ = (
'InterfaceTemplateFilter', 'InterfaceTemplateFilter',
'InventoryItemFilter', 'InventoryItemFilter',
'InventoryItemRoleFilter', 'InventoryItemRoleFilter',
'InventoryItemTemplateFilter',
'LocationFilter', 'LocationFilter',
'MACAddressFilter', 'MACAddressFilter',
'ManufacturerFilter', 'ManufacturerFilter',
@ -253,6 +253,16 @@ class DeviceFilter(
modules: Annotated['ModuleFilter', strawberry.lazy('dcim.graphql.filters')] | None = ( modules: Annotated['ModuleFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )
console_port_count: FilterLookup[int] | None = strawberry_django.filter_field()
console_server_port_count: FilterLookup[int] | None = strawberry_django.filter_field()
power_port_count: FilterLookup[int] | None = strawberry_django.filter_field()
power_outlet_count: FilterLookup[int] | None = strawberry_django.filter_field()
interface_count: FilterLookup[int] | None = strawberry_django.filter_field()
front_port_count: FilterLookup[int] | None = strawberry_django.filter_field()
rear_port_count: FilterLookup[int] | None = strawberry_django.filter_field()
device_bay_count: FilterLookup[int] | None = strawberry_django.filter_field()
module_bay_count: FilterLookup[int] | None = strawberry_django.filter_field()
inventory_item_count: FilterLookup[int] | None = strawberry_django.filter_field()
@strawberry_django.filter(models.DeviceBay, lookups=True) @strawberry_django.filter(models.DeviceBay, lookups=True)
@ -324,6 +334,16 @@ class DeviceTypeFilter(ImageAttachmentFilterMixin, PrimaryModelFilterMixin, Weig
rear_image: Annotated['ImageAttachmentFilter', strawberry.lazy('extras.graphql.filters')] | None = ( rear_image: Annotated['ImageAttachmentFilter', strawberry.lazy('extras.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )
console_port_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
console_server_port_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
power_port_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
power_outlet_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
interface_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
front_port_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
rear_port_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
device_bay_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
module_bay_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
inventory_item_template_count: FilterLookup[int] | None = strawberry_django.filter_field()
@strawberry_django.filter(models.FrontPort, lookups=True) @strawberry_django.filter(models.FrontPort, lookups=True)
@ -802,6 +822,7 @@ class VirtualChassisFilter(PrimaryModelFilterMixin):
master_id: ID | None = strawberry_django.filter_field() master_id: ID | None = strawberry_django.filter_field()
name: FilterLookup[str] | None = strawberry_django.filter_field() name: FilterLookup[str] | None = strawberry_django.filter_field()
domain: FilterLookup[str] | None = strawberry_django.filter_field() domain: FilterLookup[str] | None = strawberry_django.filter_field()
member_count: FilterLookup[int] | None = strawberry_django.filter_field()
@strawberry_django.filter(models.VirtualDeviceContext, lookups=True) @strawberry_django.filter(models.VirtualDeviceContext, lookups=True)

View File

@ -39,10 +39,7 @@ class TagsFilterMixin(BaseFilterMixin):
@dataclass @dataclass
class ConfigContextFilterMixin(BaseFilterMixin): class ConfigContextFilterMixin(BaseFilterMixin):
local_config_context: Annotated['ConfigContextFilter', strawberry.lazy('extras.graphql.filters')] | None = ( local_context_data: Annotated['JSONFilter', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
strawberry_django.filter_field()
)
config_context: Annotated['ConfigContextFilter', strawberry.lazy('extras.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )

View File

@ -118,7 +118,12 @@ class CustomFieldFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin):
type: Annotated['CustomFieldTypeEnum', strawberry.lazy('extras.graphql.enums')] | None = ( type: Annotated['CustomFieldTypeEnum', strawberry.lazy('extras.graphql.enums')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )
related_object_type_id: ID | None = strawberry_django.filter_field() object_types: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field()
)
related_object_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field()
)
name: FilterLookup[str] | None = strawberry_django.filter_field() name: FilterLookup[str] | None = strawberry_django.filter_field()
label: FilterLookup[str] | None = strawberry_django.filter_field() label: FilterLookup[str] | None = strawberry_django.filter_field()
group_name: FilterLookup[str] | None = strawberry_django.filter_field() group_name: FilterLookup[str] | None = strawberry_django.filter_field()
@ -202,6 +207,9 @@ class ExportTemplateFilter(BaseObjectTypeFilterMixin, SyncedDataFilterMixin, Cha
@strawberry_django.filter(models.ImageAttachment, lookups=True) @strawberry_django.filter(models.ImageAttachment, lookups=True)
class ImageAttachmentFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin): class ImageAttachmentFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin):
object_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field()
)
object_id: ID | None = strawberry_django.filter_field() object_id: ID | None = strawberry_django.filter_field()
image_height: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = ( image_height: Annotated['IntegerLookup', strawberry.lazy('netbox.graphql.filter_lookups')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()

View File

@ -107,7 +107,7 @@ class FHRPGroupFilter(PrimaryModelFilterMixin):
@strawberry_django.filter(models.FHRPGroupAssignment, lookups=True) @strawberry_django.filter(models.FHRPGroupAssignment, lookups=True)
class FHRPGroupAssignmentFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin): class FHRPGroupAssignmentFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin):
inteface_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = ( interface_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )
interface_id: FilterLookup[str] | None = strawberry_django.filter_field() interface_id: FilterLookup[str] | None = strawberry_django.filter_field()

View File

@ -150,6 +150,9 @@ class ContactGroupFilter(NestedGroupModelFilterMixin):
@strawberry_django.filter(models.ContactAssignment, lookups=True) @strawberry_django.filter(models.ContactAssignment, lookups=True)
class ContactAssignmentFilter(CustomFieldsFilterMixin, TagsFilterMixin, ChangeLogFilterMixin): class ContactAssignmentFilter(CustomFieldsFilterMixin, TagsFilterMixin, ChangeLogFilterMixin):
object_type: Annotated['ContentTypeFilter', strawberry.lazy('core.graphql.filters')] | None = (
strawberry_django.filter_field()
)
object_id: ID | None = strawberry_django.filter_field() object_id: ID | None = strawberry_django.filter_field()
contact: Annotated['ContactFilter', strawberry.lazy('tenancy.graphql.filters')] | None = ( contact: Annotated['ContactFilter', strawberry.lazy('tenancy.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()

View File

@ -45,7 +45,9 @@ class UserFilter(BaseObjectTypeFilterMixin):
first_name: FilterLookup[str] | None = strawberry_django.filter_field() first_name: FilterLookup[str] | None = strawberry_django.filter_field()
last_name: FilterLookup[str] | None = strawberry_django.filter_field() last_name: FilterLookup[str] | None = strawberry_django.filter_field()
email: FilterLookup[str] | None = strawberry_django.filter_field() email: FilterLookup[str] | None = strawberry_django.filter_field()
is_superuser: FilterLookup[bool] | None = strawberry_django.filter_field()
is_staff: FilterLookup[bool] | None = strawberry_django.filter_field() is_staff: FilterLookup[bool] | None = strawberry_django.filter_field()
is_active: FilterLookup[bool] | None = strawberry_django.filter_field() is_active: FilterLookup[bool] | None = strawberry_django.filter_field()
date_joined: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field() date_joined: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
last_login: DatetimeFilterLookup[datetime] | None = strawberry_django.filter_field()
groups: Annotated['GroupFilter', strawberry.lazy('users.graphql.filters')] | None = strawberry_django.filter_field() groups: Annotated['GroupFilter', strawberry.lazy('users.graphql.filters')] | None = strawberry_django.filter_field()

View File

@ -79,6 +79,7 @@ class VirtualMachineFilter(
TenancyFilterMixin, TenancyFilterMixin,
PrimaryModelFilterMixin, PrimaryModelFilterMixin,
): ):
name: FilterLookup[str] | None = strawberry_django.filter_field()
site: Annotated['SiteFilter', strawberry.lazy('dcim.graphql.filters')] | None = strawberry_django.filter_field() site: Annotated['SiteFilter', strawberry.lazy('dcim.graphql.filters')] | None = strawberry_django.filter_field()
site_id: ID | None = strawberry_django.filter_field() site_id: ID | None = strawberry_django.filter_field()
cluster: Annotated['ClusterFilter', strawberry.lazy('virtualization.graphql.filters')] | None = ( cluster: Annotated['ClusterFilter', strawberry.lazy('virtualization.graphql.filters')] | None = (
@ -116,6 +117,8 @@ class VirtualMachineFilter(
strawberry_django.filter_field() strawberry_django.filter_field()
) )
serial: FilterLookup[str] | None = strawberry_django.filter_field() serial: FilterLookup[str] | None = strawberry_django.filter_field()
interface_count: FilterLookup[int] | None = strawberry_django.filter_field()
virtual_disk_count: FilterLookup[int] | None = strawberry_django.filter_field()
interfaces: Annotated['VMInterfaceFilter', strawberry.lazy('virtualization.graphql.filters')] | None = ( interfaces: Annotated['VMInterfaceFilter', strawberry.lazy('virtualization.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )

View File

@ -49,6 +49,9 @@ class WirelessLANFilter(
PrimaryModelFilterMixin PrimaryModelFilterMixin
): ):
ssid: FilterLookup[str] | None = strawberry_django.filter_field() ssid: FilterLookup[str] | None = strawberry_django.filter_field()
status: Annotated['WirelessLANStatusEnum', strawberry.lazy('wireless.graphql.enums')] | None = (
strawberry_django.filter_field()
)
group: Annotated['WirelessLANGroupFilter', strawberry.lazy('wireless.graphql.filters')] | None = ( group: Annotated['WirelessLANGroupFilter', strawberry.lazy('wireless.graphql.filters')] | None = (
strawberry_django.filter_field() strawberry_django.filter_field()
) )