logger-auth
This commit is contained in:
parent
6243c27390
commit
1162c62a9b
|
@ -30,8 +30,7 @@ from services.rediscache import redis
|
||||||
@mutation.field('follow')
|
@mutation.field('follow')
|
||||||
@login_required
|
@login_required
|
||||||
async def follow(_, info, what, slug):
|
async def follow(_, info, what, slug):
|
||||||
follows = None
|
follows = []
|
||||||
logger.debug(info.context['request'])
|
|
||||||
try:
|
try:
|
||||||
user_id = info.context['user_id']
|
user_id = info.context['user_id']
|
||||||
follower_query = (
|
follower_query = (
|
||||||
|
@ -64,11 +63,10 @@ async def follow(_, info, what, slug):
|
||||||
elif what == 'REACTIONS':
|
elif what == 'REACTIONS':
|
||||||
reactions_follow(follower.id, slug)
|
reactions_follow(follower.id, slug)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(info, what, slug)
|
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
return {'error': str(e), f'{what.lower()}s': follows}
|
return {'error': str(e)}
|
||||||
|
|
||||||
return {}
|
return {f'{what.lower()}s': follows}
|
||||||
|
|
||||||
|
|
||||||
@mutation.field('unfollow')
|
@mutation.field('unfollow')
|
||||||
|
@ -107,9 +105,9 @@ async def unfollow(_, info, what, slug):
|
||||||
elif what == 'REACTIONS':
|
elif what == 'REACTIONS':
|
||||||
reactions_unfollow(follower.id, slug)
|
reactions_unfollow(follower.id, slug)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'error': str(e), f'{what.lower()}s': follows}
|
return {'error': str(e)}
|
||||||
|
|
||||||
return {}
|
return {f'{what.lower()}s': follows}
|
||||||
|
|
||||||
|
|
||||||
async def get_follows_by_user_id(user_id: str):
|
async def get_follows_by_user_id(user_id: str):
|
||||||
|
|
|
@ -79,6 +79,7 @@ def login_required(f):
|
||||||
req = info.context.get('request')
|
req = info.context.get('request')
|
||||||
authorized = await check_auth(req)
|
authorized = await check_auth(req)
|
||||||
if authorized:
|
if authorized:
|
||||||
|
logger.info(authorized)
|
||||||
user_id, user_roles = authorized
|
user_id, user_roles = authorized
|
||||||
if user_id and user_roles:
|
if user_id and user_roles:
|
||||||
logger.info(f' got {user_id} roles: {user_roles}')
|
logger.info(f' got {user_id} roles: {user_roles}')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user