Some checks failed
Test before pr merge / test-lint (pull_request) Failing after 7s
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
from cpl.graphql.schema.filter.filter import Filter
|
|
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
|
|
from model.author import Author
|
|
|
|
class AuthorFilter(Filter[Author]):
|
|
def __init__(self):
|
|
Filter.__init__(self)
|
|
self.int_field("id")
|
|
self.string_field("firstName")
|
|
self.string_field("lastName")
|
|
|
|
class AuthorSort(Sort[Author]):
|
|
def __init__(self):
|
|
Sort.__init__(self)
|
|
self.field("id", SortOrder)
|
|
self.field("firstName", SortOrder)
|
|
self.field("lastName", SortOrder)
|
|
|
|
class AuthorGraphType(GraphType[Author]):
|
|
|
|
def __init__(self):
|
|
GraphType.__init__(self)
|
|
|
|
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)
|