From ecf07276311ba6331b3fb5cc13446c004c8757a5 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 Nov 2023 14:04:55 +0300 Subject: [PATCH] joined-createdby-fix --- resolvers/editor.py | 6 +++--- resolvers/reader.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resolvers/editor.py b/resolvers/editor.py index cfe46fbb..880c0982 100644 --- a/resolvers/editor.py +++ b/resolvers/editor.py @@ -22,11 +22,11 @@ async def get_shouts_drafts(_, info): q = ( select(Shout) .options( - joinedload(Shout.created_by, Author.id == Shout.created_by), + # joinedload(Shout.created_by, Author.id == Shout.created_by), joinedload(Shout.authors), joinedload(Shout.topics), ) - .where(and_(Shout.deleted_at.is_(None), Shout.created_by == author.id)) + .filter(and_(Shout.deleted_at.is_(None), Shout.created_by == author.id)) ) q = q.group_by(Shout.id) shouts = [] @@ -88,7 +88,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False): shout = ( session.query(Shout) .options( - joinedload(Shout.created_by, Author.id == Shout.created_by), + # joinedload(Shout.created_by, Author.id == Shout.created_by), joinedload(Shout.authors), joinedload(Shout.topics), ) diff --git a/resolvers/reader.py b/resolvers/reader.py index f35bfc8e..475c254f 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -72,7 +72,7 @@ def apply_filters(q, filters, author_id=None): async def get_shout(_, _info, slug=None, shout_id=None): with local_session() as session: q = select(Shout).options( - joinedload(Shout.created_by), + # joinedload(Shout.created_by), joinedload(Shout.authors), joinedload(Shout.topics), ) @@ -142,7 +142,7 @@ async def load_shouts_by(_, info, options): q = ( select(Shout) .options( - joinedload(Shout.created_by, Author.id == Shout.created_by), + # joinedload(Shout.created_by, Author.id == Shout.created_by), joinedload(Shout.authors), joinedload(Shout.topics), ) @@ -203,13 +203,13 @@ async def load_shouts_feed(_, info, options): q = ( select(Shout) .options( - joinedload(Shout.created_by, Author.id == Shout.created_by), + # joinedload(Shout.created_by, Author.id == Shout.created_by), joinedload(Shout.authors), joinedload(Shout.topics), ) .where( and_( - Shout.published_at != None, + Shout.published_at.is_not(None), Shout.deleted_at.is_(None), Shout.id.in_(subquery), )