add newShoutsWithoutRating
This commit is contained in:
parent
073c5252c3
commit
1f3983fc07
|
@ -416,3 +416,19 @@ async def shouts_by_user_rating_or_comment(_, info, userSlug, page, size):
|
||||||
offset( (page - 1) * size)
|
offset( (page - 1) * size)
|
||||||
|
|
||||||
return shouts
|
return shouts
|
||||||
|
|
||||||
|
@query.field("newShoutsWithoutRating")
|
||||||
|
async def new_shouts_without_rating(_, info, userSlug, size):
|
||||||
|
user = await UserStorage.get_user_by_slug(userSlug)
|
||||||
|
if not user:
|
||||||
|
return
|
||||||
|
|
||||||
|
#TODO: postgres heavy load
|
||||||
|
with local_session() as session:
|
||||||
|
shouts = session.query(Shout).distinct().\
|
||||||
|
outerjoin(ShoutRating).\
|
||||||
|
where(and_(Shout.publishedAt != None, ShoutRating.rater != userSlug)).\
|
||||||
|
order_by(desc(Shout.publishedAt)).\
|
||||||
|
limit(size)
|
||||||
|
|
||||||
|
return shouts
|
||||||
|
|
|
@ -199,6 +199,7 @@ type Query {
|
||||||
|
|
||||||
# shoutsByUserSubscriptions(): [Shout]!
|
# shoutsByUserSubscriptions(): [Shout]!
|
||||||
shoutsByUserRatingOrComment(userSlug: String!, page: Int!, size: Int!): [Shout]!
|
shoutsByUserRatingOrComment(userSlug: String!, page: Int!, size: Int!): [Shout]!
|
||||||
|
newShoutsWithoutRating(userSlug: String!, size: Int = 10): [Shout]!
|
||||||
}
|
}
|
||||||
|
|
||||||
############################################ Subscription
|
############################################ Subscription
|
||||||
|
|
Loading…
Reference in New Issue
Block a user