This commit is contained in:
parent
5f8ec549df
commit
14ae7fbcc9
|
@ -20,7 +20,7 @@ class ReactionKind(Enumeration):
|
||||||
REJECT = 8 # -1
|
REJECT = 8 # -1
|
||||||
|
|
||||||
# public feed
|
# public feed
|
||||||
QUOTE = 9 # +0 bookmark
|
QUOTE = 9 # +0 TODO: use to bookmark in collection
|
||||||
COMMENT = 0 # +0
|
COMMENT = 0 # +0
|
||||||
LIKE = 11 # +1
|
LIKE = 11 # +1
|
||||||
DISLIKE = 12 # -1
|
DISLIKE = 12 # -1
|
||||||
|
|
|
@ -5,10 +5,11 @@ from sqlalchemy.sql.expression import desc, asc, select, func, case, and_, nulls
|
||||||
from services.auth import login_required
|
from services.auth import login_required
|
||||||
from services.db import local_session
|
from services.db import local_session
|
||||||
from services.schema import query
|
from services.schema import query
|
||||||
from orm.topic import TopicFollower
|
from orm.author import AuthorFollower, Author
|
||||||
|
from orm.topic import TopicFollower, Topic
|
||||||
|
from orm.community import CommunityAuthor as CommunityFollower, Community
|
||||||
from orm.reaction import Reaction, ReactionKind
|
from orm.reaction import Reaction, ReactionKind
|
||||||
from orm.shout import Shout, ShoutAuthor, ShoutTopic
|
from orm.shout import Shout, ShoutAuthor, ShoutTopic
|
||||||
from orm.author import AuthorFollower, Author
|
|
||||||
from services.search import SearchService
|
from services.search import SearchService
|
||||||
from services.viewed import ViewedStorage
|
from services.viewed import ViewedStorage
|
||||||
|
|
||||||
|
@ -192,6 +193,7 @@ async def get_my_feed(_, info, options):
|
||||||
user_id = info.context["user_id"]
|
user_id = info.context["user_id"]
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
if author:
|
||||||
author_followed_authors = select(AuthorFollower.author).where(AuthorFollower.follower == author.id)
|
author_followed_authors = select(AuthorFollower.author).where(AuthorFollower.follower == author.id)
|
||||||
author_followed_topics = select(TopicFollower.topic).where(TopicFollower.follower == author.id)
|
author_followed_topics = select(TopicFollower.topic).where(TopicFollower.follower == author.id)
|
||||||
|
|
||||||
|
@ -244,6 +246,7 @@ async def get_my_feed(_, info, options):
|
||||||
}
|
}
|
||||||
shouts.append(shout)
|
shouts.append(shout)
|
||||||
return shouts
|
return shouts
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
@query.field("search")
|
@query.field("search")
|
||||||
|
@ -260,10 +263,10 @@ async def load_my_subscriptions(_, info):
|
||||||
user_id = info.context["user_id"]
|
user_id = info.context["user_id"]
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
if author:
|
||||||
authors_query = (
|
authors_query = (
|
||||||
select(User)
|
select(Author)
|
||||||
.join(AuthorFollower, AuthorFollower.author == User.id)
|
.join(AuthorFollower, AuthorFollower.author == Author.id)
|
||||||
.where(AuthorFollower.follower == author.id)
|
.where(AuthorFollower.follower == author.id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user