shout-following-upgrade
All checks were successful
Deploy on push / deploy (push) Successful in 5m59s

This commit is contained in:
2025-10-05 22:53:30 +03:00
parent 86dec15673
commit 33fbd4051f
5 changed files with 61 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ from cache.cache import (
from orm.author import Author, AuthorFollower
from orm.community import Community, CommunityAuthor, CommunityFollower
from orm.reaction import Reaction
from orm.shout import Shout, ShoutAuthor, ShoutTopic
from orm.shout import Shout, ShoutAuthor, ShoutReactionsFollower, ShoutTopic
from orm.topic import Topic
from resolvers.stat import get_with_stat
from services.auth import login_required
@@ -974,12 +974,23 @@ async def get_author_follows(
has_access = is_admin or (viewer_id is not None and str(viewer_id) == str(temp_author.id))
followed_authors.append(temp_author.dict(has_access))
# Получаем подписанные шауты
followed_shouts = []
with local_session() as session:
shout_followers = (
session.query(ShoutReactionsFollower).filter(ShoutReactionsFollower.follower == author_id).all()
)
for sf in shout_followers:
shout = session.query(Shout).filter(Shout.id == sf.shout).first()
if shout:
followed_shouts.append(shout.dict())
followed_communities = DEFAULT_COMMUNITIES # TODO: get followed communities
return {
"authors": followed_authors,
"topics": followed_topics,
"communities": followed_communities,
"shouts": [],
"shouts": followed_shouts,
"error": None,
}