drafts-ordered
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from sqlalchemy import and_, select
|
from sqlalchemy import and_, select, desc
|
||||||
from sqlalchemy.orm import joinedload
|
from sqlalchemy.orm import joinedload
|
||||||
|
|
||||||
from orm.author import Author
|
from orm.author import Author
|
||||||
@@ -31,6 +31,7 @@ async def get_shouts_drafts(_, info):
|
|||||||
.options(joinedload(Shout.authors), joinedload(Shout.topics))
|
.options(joinedload(Shout.authors), joinedload(Shout.topics))
|
||||||
.filter(and_(Shout.deleted_at.is_(None), Shout.created_by == author.id))
|
.filter(and_(Shout.deleted_at.is_(None), Shout.created_by == author.id))
|
||||||
.filter(Shout.published_at.is_(None))
|
.filter(Shout.published_at.is_(None))
|
||||||
|
.order_by(desc(Shout.created_at))
|
||||||
.group_by(Shout.id)
|
.group_by(Shout.id)
|
||||||
)
|
)
|
||||||
shouts = [shout for [shout] in session.execute(q).unique()]
|
shouts = [shout for [shout] in session.execute(q).unique()]
|
||||||
|
|||||||
Reference in New Issue
Block a user