publish via update shout

This commit is contained in:
bniwredyc
2023-05-08 19:06:01 +02:00
parent e0bef72de9
commit e56b083b7f
3 changed files with 33 additions and 49 deletions

View File

@@ -70,17 +70,27 @@ def apply_filters(q, filters, user_id=None):
return q
@query.field("loadShout")
async def load_shout(_, info, slug):
async def load_shout(_, info, slug=None, shout_id=None):
with local_session() as session:
q = select(Shout).options(
joinedload(Shout.authors),
joinedload(Shout.topics),
)
q = add_stat_columns(q)
if slug is not None:
q = q.filter(
Shout.slug == slug
)
if shout_id is not None:
q = q.filter(
Shout.id == shout_id
)
q = q.filter(
Shout.slug == slug
).filter(
Shout.deletedAt.is_(None)
).group_by(Shout.id)
@@ -195,6 +205,7 @@ async def load_shouts_by(_, info, options):
return shouts
@query.field("loadDrafts")
async def get_drafts(_, info):
auth: AuthCredentials = info.context["request"].auth
@@ -217,7 +228,6 @@ async def get_drafts(_, info):
return shouts
@query.field("myFeed")
@login_required
async def get_my_feed(_, info, options):