Merge branch 'prepare-comments' of github.com:Discours/discours-backend into prepare-comments

This commit is contained in:
Igor Lobanov 2022-11-23 13:51:00 +01:00
commit 782c34a62b
2 changed files with 5 additions and 5 deletions

View File

@ -9,9 +9,9 @@ class JWTCodec:
@staticmethod
def encode(user: AuthInput, exp: datetime) -> str:
issued = int(datetime.now().timestamp())
print('[jwtcodec] issued at %r' % issued)
print('[auth.jwtcodec] issued at %r' % issued)
expires = int(exp.timestamp())
print('[jwtcodec] expires at %r' % expires)
print('[auth.jwtcodec] expires at %r' % expires)
payload = {
"user_id": user.id,
"username": user.email or user.phone,
@ -23,7 +23,7 @@ class JWTCodec:
try:
return jwt.encode(payload, JWT_SECRET_KEY, JWT_ALGORITHM)
except Exception as e:
print('[jwtcodec] JWT encode error %r' % e)
print('[auth.jwtcodec] JWT encode error %r' % e)
@staticmethod
def decode(token: str, verify_exp: bool = True) -> TokenPayload:
@ -39,7 +39,7 @@ class JWTCodec:
issuer="discours"
)
r = TokenPayload(**payload)
print('[jwtcodec] debug payload %r' % r)
print('[auth.jwtcodec] debug payload %r' % r)
return r
except jwt.InvalidIssuedAtError:
raise ExpiredToken('check token issued time')

View File

@ -36,7 +36,7 @@ class ReactedStorage:
@staticmethod
async def get_shout_stat(slug):
viewed = int(await ViewedStorage.get_shout(slug))
print(viewed)
# print(viewed)
return {
"viewed": viewed,
"reacted": len(await ReactedStorage.get_shout(slug)),