This commit is contained in:
parent
caa2dbfdf3
commit
53a0f2e328
|
@ -18,6 +18,7 @@ async def get_drafts(_, info):
|
||||||
user_id = info.context["user_id"]
|
user_id = info.context["user_id"]
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
if author:
|
||||||
q = (
|
q = (
|
||||||
select(Shout)
|
select(Shout)
|
||||||
.options(
|
.options(
|
||||||
|
@ -39,6 +40,7 @@ async def create_shout(_, info, inp):
|
||||||
user_id = info.context["user_id"]
|
user_id = info.context["user_id"]
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
if author:
|
||||||
topics = session.query(Topic).filter(Topic.slug.in_(inp.get("topics", []))).all()
|
topics = session.query(Topic).filter(Topic.slug.in_(inp.get("topics", []))).all()
|
||||||
authors = inp.get("authors", [])
|
authors = inp.get("authors", [])
|
||||||
if author.id not in authors:
|
if author.id not in authors:
|
||||||
|
@ -83,6 +85,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
||||||
user_id = info.context["user_id"]
|
user_id = info.context["user_id"]
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
|
if author:
|
||||||
shout = (
|
shout = (
|
||||||
session.query(Shout)
|
session.query(Shout)
|
||||||
.options(
|
.options(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user