This commit is contained in:
2022-06-14 11:33:41 +03:00
parent 9a685590fb
commit 7d26948cc1
5 changed files with 5 additions and 20 deletions

View File

@@ -1,7 +1,8 @@
from resolvers.auth import login, sign_out, is_email_free, register, confirm
from resolvers.zine import create_shout, get_shout_by_slug, \
top_month, top_overall, recent_published, recent_all, top_viewed, shouts_by_authors, shouts_by_topics, shouts_by_communities, \
shouts_candidates, shouts_reviewed, shouts_subscribed
top_month, top_overall, recent_published, recent_all, top_viewed, \
shouts_by_authors, shouts_by_topics, shouts_by_communities, \
shouts_reviewed, shouts_subscribed
from resolvers.profile import get_users_by_slugs, get_current_user
from resolvers.topics import topic_subscribe, topic_unsubscribe, topics_by_author, \
topics_by_community, topics_by_slugs
@@ -26,7 +27,6 @@ __all__ = [
"shouts_by_communities",
"shouts_subscribed",
"shouts_reviewed",
"shouts_candidates",
"top_month",
"top_overall",
"top_viewed",

View File

@@ -482,20 +482,6 @@ async def shouts_reviewed(_, info, page, size):
return shouts
@query.field("shoutsCandidates")
@login_required
async def shouts_candidates(_, info, size):
user = info.context["request"].user
#TODO: postgres heavy load
with local_session() as session:
shouts = session.query(Shout).distinct().\
outerjoin(ShoutRating).\
where(and_(Shout.publishedAt != None, ShoutRating.rater != user.slug)).\
order_by(desc(Shout.publishedAt)).\
limit(size)
return shouts
@query.field("shoutsCommentedByUser")
async def shouts_commented_by_user(_, info, slug, page, size):
user = await UserStorage.get_user_by_slug(slug)