This commit is contained in:
parent
a79f3cd5ec
commit
ea5b9e5b09
|
@ -28,8 +28,8 @@ build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pytest = "^7.4.2"
|
pytest = "^7.4.2"
|
||||||
black = { version = "^23.9.1", python = ">=3.12" }
|
black = { version = "^23.12.0", python = ">=3.12" }
|
||||||
ruff = { version = "^0.1.0", python = ">=3.12" }
|
ruff = { version = "^0.1.8", python = ">=3.12" }
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
|
|
|
@ -97,26 +97,20 @@ async def get_my_followed(_, info):
|
||||||
authors_query = (
|
authors_query = (
|
||||||
select(Author)
|
select(Author)
|
||||||
.join(AuthorFollower, AuthorFollower.author == Author.id)
|
.join(AuthorFollower, AuthorFollower.author == Author.id)
|
||||||
.where(AuthorFollower.follower == author.id)
|
.filter(AuthorFollower.follower == author.id)
|
||||||
)
|
)
|
||||||
|
|
||||||
topics_query = select(Topic).join(TopicFollower).where(TopicFollower.follower == author.id)
|
topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id)
|
||||||
communities_query = (
|
communities_query = (
|
||||||
select(Community)
|
select(Community)
|
||||||
.join(CommunityAuthor, CommunityAuthor.author == Author.id)
|
.join(CommunityAuthor, CommunityAuthor.author == Author.id)
|
||||||
.where(CommunityAuthor.author == author.id)
|
.filter(CommunityAuthor.author == author.id)
|
||||||
)
|
)
|
||||||
topics = []
|
|
||||||
authors = []
|
|
||||||
communities = []
|
|
||||||
for [author] in session.execute(authors_query):
|
|
||||||
authors.append(author)
|
|
||||||
|
|
||||||
for [topic] in session.execute(topics_query):
|
topics = [t for [t] in session.execute(topics_query)]
|
||||||
topics.append(topic)
|
authors = [a for [a] in session.execute(authors_query)]
|
||||||
|
communities = [c for [c] in session.execute(communities_query)]
|
||||||
|
|
||||||
for [c] in session.execute(communities_query):
|
|
||||||
communities.append(c)
|
|
||||||
return {"topics": topics, "authors": authors, "communities": communities}
|
return {"topics": topics, "authors": authors, "communities": communities}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user