followed-by
All checks were successful
Deploy on push / deploy (push) Successful in 1m9s

This commit is contained in:
Untone 2024-07-03 15:35:12 +03:00
parent d55a3050fc
commit 1223c633d4
3 changed files with 18 additions and 1 deletions

View File

@ -24,6 +24,7 @@ from resolvers.reaction import (
delete_reaction,
load_reactions_by,
load_shouts_followed,
load_shouts_followed_by,
update_reaction,
)
from resolvers.reader import (
@ -76,6 +77,7 @@ __all__ = [
"load_shouts_feed",
"load_shouts_search",
"load_shouts_followed",
"load_shouts_followed_by",
"load_shouts_unrated",
"load_shouts_random_top",
"load_shouts_random_topic",

View File

@ -496,3 +496,17 @@ async def load_shouts_followed(_, info, limit=50, offset=0) -> List[Shout]:
except Exception as error:
logger.debug(error)
return []
@query.field("load_shouts_followed_by")
async def load_shouts_followed_by(_, info, slug: str, limit=50, offset=0) -> List[Shout]:
with local_session() as session:
author = session.query(Author).filter(Author.slug == slug).first()
if author:
try:
author_id: int = author.dict()["id"]
shouts = await reacted_shouts_updates(author_id, limit, offset)
return shouts
except Exception as error:
logger.debug(error)
return []

View File

@ -18,7 +18,8 @@ type Query {
get_author_follows(slug: String, user: String, author_id: Int): CommonResult!
get_author_follows_topics(slug: String, user: String, author_id: Int): [Topic]
get_author_follows_authors(slug: String, user: String, author_id: Int): [Author]
load_shouts_followed(limit: Int, offset: Int): [Shout] # userReactedShouts
load_shouts_followed(limit: Int, offset: Int): [Shout]
load_shouts_followed_by(slug: String, limit: Int, offset: Int): [Shout]
# reaction
load_reactions_by(by: ReactionBy!, limit: Int, offset: Int): [Reaction]