From 7fd0b7e64348a67270e0d2410d8abf4c9f22eadd Mon Sep 17 00:00:00 2001 From: knst-kotov Date: Sun, 12 Jun 2022 11:33:24 +0300 Subject: [PATCH] add community to shoutsSubscribed --- resolvers/zine.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resolvers/zine.py b/resolvers/zine.py index 2b96c8ee..ac044378 100644 --- a/resolvers/zine.py +++ b/resolvers/zine.py @@ -1,5 +1,6 @@ from orm import Shout, ShoutAuthor, ShoutTopic, ShoutRating, ShoutViewByDay, User, Community, Resource,\ ShoutRatingStorage, ShoutViewStorage, Comment, CommentRating, Topic +from orm.community import CommunitySubscription from orm.base import local_session from orm.user import UserStorage, AuthorSubscription from orm.topic import TopicSubscription @@ -451,7 +452,12 @@ async def shouts_subscribed(_, info, page, size): join(ShoutAuthor).\ join(AuthorSubscription, ShoutAuthor.user == AuthorSubscription.author).\ where(AuthorSubscription.subscriber == user.slug) + shouts_by_community = session.query(Shout).\ + join(Community).\ + join(CommunitySubscription).\ + where(CommunitySubscription.subscriber == user.slug) shouts = shouts_by_topic.union(shouts_by_author).\ + union(shouts_by_community).\ order_by(desc(Shout.createdAt)).\ limit(size).\ offset( (page - 1) * size)