Changed to strawberry #181

This commit is contained in:
2025-09-27 18:25:50 +02:00
parent a35b44b3b5
commit ada50c693e
19 changed files with 317 additions and 230 deletions

View File

@@ -1,6 +1,5 @@
from cpl.graphql.schema.filter.filter import Filter
from cpl.graphql.schema.object_graph_type import ObjectGraphType
from cpl.graphql.schema.graph_type import GraphType
from cpl.graphql.schema.sort.sort import Sort
from cpl.graphql.schema.sort.sort_order import SortOrder
@@ -25,15 +24,16 @@ class UserSort(Sort[User]):
self.field("name", SortOrder)
class UserGraphType(ObjectGraphType):
def __init__(self):
ObjectGraphType.__init__(self)
class UserGraphType(GraphType[User]):
self.string_field(
def __init__(self):
GraphType.__init__(self)
self.int_field(
"id",
resolver=lambda user, *_: user.id,
resolver=lambda root: root.id,
)
self.string_field(
"name",
resolver=lambda user, *_: user.name,
resolver=lambda root: root.name,
)