add userUnpublishedShouts
This commit is contained in:
parent
86383cb6c0
commit
d7cbe150d6
|
@ -505,3 +505,20 @@ async def shouts_rated_by_user(_, info, page, size):
|
||||||
return {
|
return {
|
||||||
"shouts" : shouts
|
"shouts" : shouts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@query.field("userUnpublishedShouts")
|
||||||
|
@login_required
|
||||||
|
async def user_unpublished_shouts(_, info, page, size):
|
||||||
|
user = info.context["request"].user
|
||||||
|
|
||||||
|
with local_session() as session:
|
||||||
|
shouts = session.query(Shout).\
|
||||||
|
join(ShoutAuthor).\
|
||||||
|
where(and_(Shout.publishedAt == None, ShoutAuthor.user == user.slug)).\
|
||||||
|
order_by(desc(Shout.createdAt)).\
|
||||||
|
limit(size).\
|
||||||
|
offset( (page - 1) * size)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"shouts" : shouts
|
||||||
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ type Query {
|
||||||
|
|
||||||
shoutsRatedByUser(page: Int!, size: Int!): ShoutsResult!
|
shoutsRatedByUser(page: Int!, size: Int!): ShoutsResult!
|
||||||
shoutsCommentedByUser(slug: String!, page: Int!, size: Int!): [Shout]!
|
shoutsCommentedByUser(slug: String!, page: Int!, size: Int!): [Shout]!
|
||||||
|
userUnpublishedShouts(page: Int!, size: Int!): ShoutsResult!
|
||||||
|
|
||||||
# shouts
|
# shouts
|
||||||
getShoutBySlug(slug: String!): Shout!
|
getShoutBySlug(slug: String!): Shout!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user