require any #181
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 6s
Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 6s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from cpl.graphql.query_context import QueryContext
|
||||
from cpl.graphql.schema.filter.filter import Filter
|
||||
from cpl.graphql.schema.graph_type import GraphType
|
||||
from cpl.graphql.schema.sort.sort import Sort
|
||||
@@ -34,11 +35,12 @@ class PostGraphType(GraphType[Post]):
|
||||
async def _a(root: Post):
|
||||
return await authors.get_by_id(root.author_id)
|
||||
|
||||
self.object_field(
|
||||
"author",
|
||||
AuthorGraphType,
|
||||
resolver=_a#lambda root: root.author_id,
|
||||
).with_public(True)
|
||||
def r_name(ctx: QueryContext):
|
||||
return ctx.user.username == "admin"
|
||||
|
||||
self.object_field("author", AuthorGraphType, resolver=_a).with_require_any(
|
||||
[], [r_name]
|
||||
)
|
||||
self.string_field(
|
||||
"title",
|
||||
resolver=lambda root: root.title,
|
||||
|
||||
Reference in New Issue
Block a user