1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

15553 change graphql sub-queries from functions to types (#15557)

* 15553 change graphql list to types

* 15553 review changes
This commit is contained in:
Arthur Hanson
2024-03-29 11:54:31 -07:00
committed by GitHub
parent c8d288671e
commit 8767577ecd
14 changed files with 226 additions and 799 deletions

View File

@ -13,8 +13,7 @@ __all__ = (
class CabledObjectMixin:
cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None
@strawberry_django.field
def link_peers(self) -> List[Annotated[Union[
link_peers: List[Annotated[Union[
Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')],
Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')],
Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')],
@ -24,15 +23,13 @@ class CabledObjectMixin:
Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')],
Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')],
Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')],
], strawberry.union("LinkPeerType")]]:
return self.link_peers
], strawberry.union("LinkPeerType")]]
@strawberry.type
class PathEndpointMixin:
@strawberry_django.field
def connected_endpoints(self) -> List[Annotated[Union[
connected_endpoints: List[Annotated[Union[
Annotated["CircuitTerminationType", strawberry.lazy('circuits.graphql.types')],
Annotated["ConsolePortType", strawberry.lazy('dcim.graphql.types')],
Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')],
@ -43,5 +40,4 @@ class PathEndpointMixin:
Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')],
Annotated["ProviderNetworkType", strawberry.lazy('circuits.graphql.types')],
Annotated["RearPortType", strawberry.lazy('dcim.graphql.types')],
], strawberry.union("ConnectedEndpointType")]]:
return self.connected_endpoints or None
], strawberry.union("ConnectedEndpointType")]]