[WIP] with authentication #181
This commit is contained in:
@@ -26,12 +26,12 @@ class AuthorGraphType(GraphType[Author]):
|
||||
self.int_field(
|
||||
"id",
|
||||
resolver=lambda root: root.id,
|
||||
)
|
||||
).with_public(True)
|
||||
self.string_field(
|
||||
"firstName",
|
||||
resolver=lambda root: root.first_name,
|
||||
)
|
||||
).with_public(True)
|
||||
self.string_field(
|
||||
"lastName",
|
||||
resolver=lambda root: root.last_name,
|
||||
)
|
||||
).with_public(True)
|
||||
|
||||
@@ -29,7 +29,7 @@ class PostGraphType(GraphType[Post]):
|
||||
self.int_field(
|
||||
"id",
|
||||
resolver=lambda root: root.id,
|
||||
)
|
||||
).with_public(True)
|
||||
|
||||
async def _a(root: Post):
|
||||
return await authors.get_by_id(root.author_id)
|
||||
@@ -38,12 +38,12 @@ class PostGraphType(GraphType[Post]):
|
||||
"author",
|
||||
AuthorGraphType,
|
||||
resolver=_a#lambda root: root.author_id,
|
||||
)
|
||||
).with_public(True)
|
||||
self.string_field(
|
||||
"title",
|
||||
resolver=lambda root: root.title,
|
||||
)
|
||||
).with_public(True)
|
||||
self.string_field(
|
||||
"content",
|
||||
resolver=lambda root: root.content,
|
||||
)
|
||||
).with_public(True)
|
||||
|
||||
Reference in New Issue
Block a user