mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 12:06: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 core import models
|
||||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
|
||||||
from .types import *
|
from .types import *
|
||||||
from utilities.graphql_optimizer import gql_query_optimizer
|
|
||||||
|
|
||||||
|
|
||||||
class CoreQuery(graphene.ObjectType):
|
@strawberry.type
|
||||||
data_file = ObjectField(DataFileType)
|
class CoreQuery:
|
||||||
data_file_list = ObjectListField(DataFileType)
|
data_file: DataFileType = strawberry_django.field()
|
||||||
|
data_file_list: List[DataFileType] = strawberry_django.field()
|
||||||
|
|
||||||
def resolve_data_file_list(root, info, **kwargs):
|
data_source: DataSourceType = strawberry_django.field()
|
||||||
return gql_query_optimizer(models.DataFile.objects.all(), info)
|
data_source_list: List[DataSourceType] = strawberry_django.field()
|
||||||
|
|
||||||
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)
|
|
||||||
|
@ -13,7 +13,8 @@ __all__ = (
|
|||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.DataFile,
|
models.DataFile,
|
||||||
fields='__all__',
|
# fields='__all__',
|
||||||
|
exclude=('data',), # bug - temp
|
||||||
filters=DataFileFilter
|
filters=DataFileFilter
|
||||||
)
|
)
|
||||||
class DataFileType(BaseObjectType):
|
class DataFileType(BaseObjectType):
|
||||||
|
@ -2,6 +2,7 @@ import strawberry
|
|||||||
from strawberry_django.optimizer import DjangoOptimizerExtension
|
from strawberry_django.optimizer import DjangoOptimizerExtension
|
||||||
from strawberry.schema.config import StrawberryConfig
|
from strawberry.schema.config import StrawberryConfig
|
||||||
from circuits.graphql.schema import CircuitsQuery
|
from circuits.graphql.schema import CircuitsQuery
|
||||||
|
from core.graphql.schema import CoreQuery
|
||||||
from users.graphql.schema import UsersQuery
|
from users.graphql.schema import UsersQuery
|
||||||
# from virtualization.graphql.schema import VirtualizationQuery
|
# from virtualization.graphql.schema import VirtualizationQuery
|
||||||
# from vpn.graphql.schema import VPNQuery
|
# from vpn.graphql.schema import VPNQuery
|
||||||
@ -12,7 +13,7 @@ from users.graphql.schema import UsersQuery
|
|||||||
class Query(
|
class Query(
|
||||||
UsersQuery,
|
UsersQuery,
|
||||||
CircuitsQuery,
|
CircuitsQuery,
|
||||||
# CoreQuery,
|
CoreQuery,
|
||||||
# DCIMQuery,
|
# DCIMQuery,
|
||||||
# ExtrasQuery,
|
# ExtrasQuery,
|
||||||
# IPAMQuery,
|
# IPAMQuery,
|
||||||
|
Loading…
Reference in New Issue
Block a user