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
|
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")
|
@mutation.field("authorSubscribe")
|
||||||
@login_required
|
@login_required
|
||||||
async def author_subscribe(_, info, slug):
|
async def author_subscribe(_, info, slug):
|
||||||
|
|
|
@ -169,6 +169,8 @@ type Query {
|
||||||
# rateUser(shout: Int): Int!
|
# rateUser(shout: Int): Int!
|
||||||
getUserRoles(slug: String!): [Role]!
|
getUserRoles(slug: String!): [Role]!
|
||||||
userComments(slug: String!, page: Int!, size: Int!): [Comment]!
|
userComments(slug: String!, page: Int!, size: Int!): [Comment]!
|
||||||
|
userSubscriptions(slug: String!): [User]!
|
||||||
|
userSubscribers(slug: String!): [User]!
|
||||||
|
|
||||||
# messages
|
# messages
|
||||||
enterChat(chatId: String!, size: Int = 50): EnterChatResult!
|
enterChat(chatId: String!, size: Int = 50): EnterChatResult!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user