paginated-authors
All checks were successful
deploy / deploy (push) Successful in 1m29s

This commit is contained in:
Untone 2023-12-09 22:02:04 +03:00
parent 275a1f9a08
commit de63f313a5
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,7 @@ from resolvers.editor import create_shout, delete_shout, update_shout
from resolvers.author import (
get_author,
get_authors_all,
load_authors_all,
get_author_followers,
get_author_followed,
load_authors_by,
@ -31,7 +31,7 @@ from resolvers.community import get_community, get_communities_all
__all__ = [
# author
"get_author",
"get_authors_all",
"load_authors_all",
"get_author_followers",
"get_author_followed",
"load_authors_by",

View File

@ -151,11 +151,12 @@ def author_unfollow(follower_id, slug):
return False
@query.field("get_authors_all")
async def get_authors_all(_, _info):
@query.field("load_authors_all")
async def load_authors_all(_, _info, limit: int = 50, offset: int = 0):
q = select(Author)
q = add_author_stat_columns(q)
q = q.join(ShoutAuthor, Author.id == ShoutAuthor.author)
q = q.limit(limit).offset(offset)
return get_authors_from_query(q)

View File

@ -331,7 +331,7 @@ type Mutation {
type Query {
# author
get_author(slug: String, user: String, author_id: Int): Author
get_authors_all: [Author]
load_authors_all(limit: Int, offset: Int): [Author]
get_author_followers(slug: String, user: String, author_id: Int): [Author]
get_author_followed(slug: String, user: String, author_id: Int): [Author]
load_authors_by(by: AuthorsBy, limit: Int, offset: Int): [Author]