get-authors-all
All checks were successful
deploy / deploy (push) Successful in 2m3s

This commit is contained in:
Untone 2023-12-19 11:09:50 +03:00
parent 8e8952dd46
commit f52db8f9e5
4 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@
- resolvers: added reader.load_shouts_top_random
- resolvers: added reader.load_shouts_unrated
- resolvers: community follower id property name is .author
- resolvers: get_authors_all and load_authors_all
- services: auth connector upgraded

View File

@ -3,6 +3,7 @@ from resolvers.author import (
get_author_followed,
get_author_followers,
get_author_id,
get_authors_all,
load_authors_all,
load_authors_by,
rate_author,
@ -32,6 +33,7 @@ __all__ = [
# author
"get_author",
"get_author_id",
"get_authors_all",
"load_authors_all",
"get_author_followers",
"get_author_followed",

View File

@ -152,6 +152,13 @@ def author_unfollow(follower_id, slug):
return False
# TODO: caching query
@query.field("get_authors_all")
async def get_authors_all(_, _info):
with local_session() as session:
return session.query(Author).join(ShoutAuthor, Author.id == ShoutAuthor.author).all()
@query.field("load_authors_all")
async def load_authors_all(_, _info, limit: int = 50, offset: int = 0):
q = select(Author)

View File

@ -330,6 +330,7 @@ type Query {
# author
get_author(slug: String, author_id: Int): Author
get_author_id(user: String!): 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]