This commit is contained in:
parent
b73cce5431
commit
71c2e8ea13
|
@ -2,7 +2,7 @@ import json
|
||||||
import time
|
import time
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from sqlalchemy import or_, select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.sql import and_
|
from sqlalchemy.sql import and_
|
||||||
|
|
||||||
from orm.author import Author, AuthorFollower
|
from orm.author import Author, AuthorFollower
|
||||||
|
@ -289,12 +289,12 @@ def author_unfollow(follower_id, slug):
|
||||||
|
|
||||||
|
|
||||||
@query.field("get_topic_followers")
|
@query.field("get_topic_followers")
|
||||||
async def get_topic_followers(_, _info, slug: str, topic_id: int) -> List[Author]:
|
async def get_topic_followers(_, _info, slug: str) -> List[Author]:
|
||||||
topic_followers_query = select(Author)
|
topic_followers_query = select(Author)
|
||||||
topic_followers_query = (
|
topic_followers_query = (
|
||||||
topic_followers_query.join(TopicFollower, TopicFollower.follower == Author.id)
|
topic_followers_query.join(TopicFollower, TopicFollower.follower == Author.id)
|
||||||
.join(Topic, Topic.id == TopicFollower.topic)
|
.join(Topic, Topic.id == TopicFollower.topic)
|
||||||
.filter(or_(Topic.slug == slug, Topic.id == topic_id))
|
.filter(Topic.slug == slug)
|
||||||
)
|
)
|
||||||
return get_with_stat(topic_followers_query)
|
return get_with_stat(topic_followers_query)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Query {
|
||||||
|
|
||||||
# follower
|
# follower
|
||||||
get_shout_followers(slug: String, shout_id: Int): [Author]
|
get_shout_followers(slug: String, shout_id: Int): [Author]
|
||||||
get_topic_followers(slug: String, topic_id: Int): [Author]
|
get_topic_followers(slug: String): [Author]
|
||||||
get_author_followers(slug: String, user: String, author_id: Int): [Author]
|
get_author_followers(slug: String, user: String, author_id: Int): [Author]
|
||||||
get_author_follows(slug: String, user: String, author_id: Int): CommonResult!
|
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_topics(slug: String, user: String, author_id: Int): [Topic]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user