This commit is contained in:
parent
2a39ab47d6
commit
981f31304d
|
|
@ -1,10 +1,12 @@
|
|||
from typing import Union
|
||||
from typing import NewType
|
||||
|
||||
import strawberry
|
||||
|
||||
BigInt = strawberry.scalar(
|
||||
Union[int, str], # type: ignore
|
||||
BigInt = NewType('BigInt', int)
|
||||
|
||||
BigIntScalar = strawberry.scalar(
|
||||
name='BigInt',
|
||||
serialize=lambda v: int(v),
|
||||
parse_value=lambda v: str(v),
|
||||
description="BigInt field",
|
||||
description='BigInt field',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ from virtualization.graphql.schema import VirtualizationQuery
|
|||
from vpn.graphql.schema import VPNQuery
|
||||
from wireless.graphql.schema import WirelessQuery
|
||||
|
||||
from .scalars import BigInt, BigIntScalar
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class Query(
|
||||
|
|
@ -36,9 +38,14 @@ class Query(
|
|||
|
||||
schema = strawberry.Schema(
|
||||
query=Query,
|
||||
config=StrawberryConfig(auto_camel_case=False),
|
||||
config=StrawberryConfig(
|
||||
auto_camel_case=False,
|
||||
scalar_map={
|
||||
BigInt: BigIntScalar,
|
||||
},
|
||||
),
|
||||
extensions=[
|
||||
DjangoOptimizerExtension(prefetch_custom_queryset=True),
|
||||
MaxAliasesLimiter(max_alias_count=settings.GRAPHQL_MAX_ALIASES),
|
||||
]
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue