async-login-requiered
All checks were successful
Deploy on push / deploy (push) Successful in 23s

This commit is contained in:
Untone 2024-02-26 12:14:08 +03:00
parent 2257c3375a
commit a93fa7fb18
3 changed files with 6 additions and 5 deletions

View File

@ -19,7 +19,7 @@ from services.logger import root_logger as logger
@mutation.field('update_author')
@login_required
def update_author(_, info, profile):
async def update_author(_, info, profile):
user_id = info.context['user_id']
with local_session() as session:
author = session.query(Author).where(Author.user == user_id).first()

View File

@ -11,7 +11,7 @@ from services.schema import mutation
@mutation.field('rate_author')
@login_required
def rate_author(_, info, rated_slug, value):
async def rate_author(_, info, rated_slug, value):
user_id = info.context['user_id']
with local_session() as session:

View File

@ -57,7 +57,7 @@ def create_topic(_, _info, inp):
@mutation.field('update_topic')
@login_required
def update_topic(_, _info, inp):
async def update_topic(_, _info, inp):
slug = inp['slug']
with local_session() as session:
topic = session.query(Topic).filter(Topic.slug == slug).first()
@ -73,7 +73,7 @@ def update_topic(_, _info, inp):
@mutation.field('delete_topic')
@login_required
def delete_topic(_, info, slug: str):
async def delete_topic(_, info, slug: str):
user_id = info.context['user_id']
with local_session() as session:
t: Topic = session.query(Topic).filter(Topic.slug == slug).first()
@ -97,7 +97,8 @@ def topic_follow(follower_id, slug):
topic = session.query(Topic).where(Topic.slug == slug).one()
_following = TopicFollower(topic=topic.id, follower=follower_id)
return True
except Exception as _exc:
except Exception as exc:
logger.error(exc)
return False