add shoutsRatedByUser
This commit is contained in:
parent
f07780895e
commit
9fab68fc29
|
@ -488,3 +488,14 @@ async def shouts_commented_by_user(_, info, slug, page, size):
|
|||
limit(size).\
|
||||
offset( (page - 1) * size)
|
||||
return shouts
|
||||
|
||||
@query.field("shoutsRatedByUser")
|
||||
async def shouts_rated_by_user(_, info, slug, page, size):
|
||||
with local_session() as session:
|
||||
shouts = session.query(Shout).\
|
||||
join(ShoutRating).\
|
||||
where(ShoutRating.rater == slug).\
|
||||
order_by(desc(ShoutRating.ts)).\
|
||||
limit(size).\
|
||||
offset( (page - 1) * size)
|
||||
return shouts
|
||||
|
|
|
@ -141,6 +141,7 @@ type Query {
|
|||
userSubscribedTopics(slug: String!): [Topic]!
|
||||
|
||||
shoutsCommentedByUser(slug: String!, page: Int!, size: Int!): [Shout]!
|
||||
shoutsRatedByUser(slug: String!, page: Int!, size: Int!): [Shout]!
|
||||
|
||||
# shouts
|
||||
getShoutBySlug(slug: String!): Shout!
|
||||
|
|
Loading…
Reference in New Issue
Block a user