add userSubscriptions and userSubscribers
This commit is contained in:
parent
57d9072ba1
commit
08c00d950f
|
@ -65,6 +65,22 @@ async def user_comments(_, info, slug, page, size):
|
|||
|
||||
return comments
|
||||
|
||||
@query.field("userSubscriptions")
|
||||
async def user_subscriptions(_, info, slug):
|
||||
with local_session() as session:
|
||||
users = session.query(User).\
|
||||
join(AuthorSubscription, User.slug == AuthorSubscription.author).\
|
||||
where(AuthorSubscription.subscriber == slug)
|
||||
return users
|
||||
|
||||
@query.field("userSubscribers")
|
||||
async def user_subscribers(_, info, slug):
|
||||
with local_session() as session:
|
||||
users = session.query(User).\
|
||||
join(AuthorSubscription, User.slug == AuthorSubscription.subscriber).\
|
||||
where(AuthorSubscription.author == slug)
|
||||
return users
|
||||
|
||||
@mutation.field("authorSubscribe")
|
||||
@login_required
|
||||
async def author_subscribe(_, info, slug):
|
||||
|
|
|
@ -169,6 +169,8 @@ type Query {
|
|||
# rateUser(shout: Int): Int!
|
||||
getUserRoles(slug: String!): [Role]!
|
||||
userComments(slug: String!, page: Int!, size: Int!): [Comment]!
|
||||
userSubscriptions(slug: String!): [User]!
|
||||
userSubscribers(slug: String!): [User]!
|
||||
|
||||
# messages
|
||||
enterChat(chatId: String!, size: Int = 50): EnterChatResult!
|
||||
|
|
Loading…
Reference in New Issue
Block a user