mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
9856 core schema
This commit is contained in:
parent
fb4d63f8a2
commit
cdcaa9055e
@ -0,0 +1,21 @@
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
from strawberry import auto
|
||||
from core import models, filtersets
|
||||
from netbox.graphql import filters
|
||||
|
||||
|
||||
__all__ = (
|
||||
'DataFileFilter',
|
||||
'DataSourceFilter',
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.DataFile, lookups=True)
|
||||
class DataFileFilter(filtersets.DataFileFilterSet):
|
||||
id: auto
|
||||
|
||||
|
||||
@strawberry_django.filter(models.DataSource, lookups=True)
|
||||
class DataSourceFilter(filtersets.DataSourceFilterSet):
|
||||
id: auto
|
@ -1,20 +1,15 @@
|
||||
import graphene
|
||||
from typing import List
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
|
||||
from core import models
|
||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||
from .types import *
|
||||
from utilities.graphql_optimizer import gql_query_optimizer
|
||||
|
||||
|
||||
class CoreQuery(graphene.ObjectType):
|
||||
data_file = ObjectField(DataFileType)
|
||||
data_file_list = ObjectListField(DataFileType)
|
||||
@strawberry.type
|
||||
class CoreQuery:
|
||||
data_file: DataFileType = strawberry_django.field()
|
||||
data_file_list: List[DataFileType] = strawberry_django.field()
|
||||
|
||||
def resolve_data_file_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.DataFile.objects.all(), info)
|
||||
|
||||
data_source = ObjectField(DataSourceType)
|
||||
data_source_list = ObjectListField(DataSourceType)
|
||||
|
||||
def resolve_data_source_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.DataSource.objects.all(), info)
|
||||
data_source: DataSourceType = strawberry_django.field()
|
||||
data_source_list: List[DataSourceType] = strawberry_django.field()
|
||||
|
@ -13,7 +13,8 @@ __all__ = (
|
||||
|
||||
@strawberry_django.type(
|
||||
models.DataFile,
|
||||
fields='__all__',
|
||||
# fields='__all__',
|
||||
exclude=('data',), # bug - temp
|
||||
filters=DataFileFilter
|
||||
)
|
||||
class DataFileType(BaseObjectType):
|
||||
|
@ -2,6 +2,7 @@ import strawberry
|
||||
from strawberry_django.optimizer import DjangoOptimizerExtension
|
||||
from strawberry.schema.config import StrawberryConfig
|
||||
from circuits.graphql.schema import CircuitsQuery
|
||||
from core.graphql.schema import CoreQuery
|
||||
from users.graphql.schema import UsersQuery
|
||||
# from virtualization.graphql.schema import VirtualizationQuery
|
||||
# from vpn.graphql.schema import VPNQuery
|
||||
@ -12,16 +13,16 @@ from users.graphql.schema import UsersQuery
|
||||
class Query(
|
||||
UsersQuery,
|
||||
CircuitsQuery,
|
||||
# CoreQuery,
|
||||
# DCIMQuery,
|
||||
# ExtrasQuery,
|
||||
# IPAMQuery,
|
||||
# TenancyQuery,
|
||||
# VirtualizationQuery,
|
||||
# VPNQuery,
|
||||
# WirelessQuery,
|
||||
# *registry['plugins']['graphql_schemas'], # Append plugin schemas
|
||||
# graphene.ObjectType
|
||||
CoreQuery,
|
||||
# DCIMQuery,
|
||||
# ExtrasQuery,
|
||||
# IPAMQuery,
|
||||
# TenancyQuery,
|
||||
# VirtualizationQuery,
|
||||
# VPNQuery,
|
||||
# WirelessQuery,
|
||||
# *registry['plugins']['graphql_schemas'], # Append plugin schemas
|
||||
# graphene.ObjectType
|
||||
):
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user