From 6bb9d68f60b85455008e7f37f30048f296281bb0 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 23 Feb 2024 15:56:21 -0800 Subject: [PATCH] 9856 update types --- netbox/ipam/graphql/types.py | 10 ++++++++-- netbox/vpn/graphql/types.py | 11 ++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/netbox/ipam/graphql/types.py b/netbox/ipam/graphql/types.py index 0fd7f086f..31bd0a9d9 100644 --- a/netbox/ipam/graphql/types.py +++ b/netbox/ipam/graphql/types.py @@ -1,4 +1,4 @@ -from typing import List +from typing import TYPE_CHECKING, Annotated, List, Union import strawberry import strawberry_django @@ -108,7 +108,13 @@ class FHRPGroupType(NetBoxObjectType): ) class FHRPGroupAssignmentType(BaseObjectType): # interface = graphene.Field('ipam.graphql.gfk_mixins.FHRPGroupInterfaceType') - pass + + @strawberry_django.field + def interface(self) -> Annotated[Union[ + Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')], + Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')], + ], strawberry.union("FHRPGroupInterfaceType")]: + return self.interface @strawberry_django.type( diff --git a/netbox/vpn/graphql/types.py b/netbox/vpn/graphql/types.py index cf3cc6d27..68fe39403 100644 --- a/netbox/vpn/graphql/types.py +++ b/netbox/vpn/graphql/types.py @@ -1,3 +1,5 @@ +from typing import Annotated, List + import strawberry import strawberry_django @@ -62,7 +64,14 @@ class IKEProposalType(OrganizationalObjectType): filters=IKEPolicyFilter ) class IKEPolicyType(OrganizationalObjectType): - pass + + @strawberry_django.field + def proposals(self) -> List[Annotated["IKEProposalType", strawberry.lazy('vpn.graphql.types')]]: + return self.proposals.all() + + @strawberry_django.field + def ipsec_profiles(self) -> List[Annotated["IPSecProposalType", strawberry.lazy('vpn.graphql.types')]]: + return self.ipsec_profiles.all() @strawberry_django.type(