code review, all authors query restored

This commit is contained in:
Igor Lobanov
2022-11-18 01:38:29 +01:00
parent 7969f67c67
commit aee83c31b5
5 changed files with 133 additions and 89 deletions

View File

@@ -12,6 +12,7 @@ from orm.user import AuthorFollower, Role, User, UserRating, UserRole
from services.auth.users import UserStorage
from services.stat.reacted import ReactedStorage
from services.stat.topicstat import TopicStat
from services.zine.authors import AuthorsStorage
from services.zine.shoutauthor import ShoutAuthorStorage
# from .community import followed_communities
@@ -174,12 +175,9 @@ def author_unfollow(user, slug):
@query.field("authorsAll")
async def get_authors_all(_, _info):
users = await UserStorage.get_all_users()
authors = []
for author in users:
if ShoutAuthorStorage.shouts_by_author.get(author.slug):
author.stat = await get_author_stat(author.slug)
authors.append(author)
authors = await AuthorsStorage.get_all_authors()
for author in authors:
author.stat = await get_author_stat(author.slug)
return authors