[WIP] with authentication #181
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s

This commit is contained in:
2025-09-28 11:45:51 +02:00
parent 652304a480
commit d42b89809b
15 changed files with 362 additions and 57 deletions

View File

@@ -85,7 +85,7 @@ def main():
schema.query.string_field("ping", resolver=lambda: "pong")
schema.query.with_query("hello", HelloQuery)
schema.query.dao_collection_field(AuthorGraphType, AuthorDao, "authors", AuthorFilter, AuthorSort)
schema.query.dao_collection_field(PostGraphType, PostDao, "posts", PostFilter, PostSort)
schema.query.dao_collection_field(PostGraphType, PostDao, "posts", PostFilter, PostSort).with_public(True)
app.with_playground()
app.with_graphiql()

View File

@@ -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)

View File

@@ -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)