thread-id-fix
All checks were successful
deploy / deploy (push) Successful in 1m12s

This commit is contained in:
Untone 2023-12-22 13:08:35 +03:00
parent 999fafac71
commit 051d35869b
3 changed files with 10 additions and 2 deletions

View File

@ -66,6 +66,7 @@ async def get_notifications_grouped(
elif n.action == "create":
print(f"[resolvers.schema] create shout: {shout}")
notification_group = NotificationGroup(
id=thread_id,
entity=n.entity,
shout=shout,
authors=shout.authors,
@ -105,6 +106,7 @@ async def get_notifications_grouped(
reactions = []
reactions.append(reaction.id)
notification_group = NotificationGroup(
id=thread_id,
action=n.action,
entity=n.entity,
updated_at=reaction.created_at,
@ -122,6 +124,7 @@ async def get_notifications_grouped(
notification_group = notifications.get(thread_id)
if not notification_group:
notification_group = NotificationGroup(
id=thread_id,
authors=[follower],
updated_at=int(time.time()),
shout=None,
@ -129,6 +132,9 @@ async def get_notifications_grouped(
entity="follower",
action="follow",
)
else:
notification_group.authors = [follower, ]
notification_group.updated_at = int(time.time())
# store group in result
notifications[thread_id] = notification_group
counter += 1

View File

@ -52,6 +52,7 @@ class NotificationReaction:
@strawberry.type
class NotificationGroup:
id: str
authors: List[NotificationAuthor]
updated_at: int
entity: str

View File

@ -47,9 +47,10 @@ async def check_auth(req) -> str | None:
print(f"[services.auth] got user_id: {user_id}")
return user_id
except Exception as e:
import traceback
traceback.print_exc()
# Handling and logging exceptions during authentication check
print(f"[services.auth] {e}")
print(f"[services.auth] Error {e}")
return None