This commit is contained in:
parent
6134b02c4a
commit
391958e60c
|
@ -56,7 +56,7 @@ ensure_newline_before_comments = true
|
||||||
line_length = 120
|
line_length = 120
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
include = ["orm", "resolvers"]
|
include = ["."]
|
||||||
exclude = ["**/__pycache__"]
|
exclude = ["**/__pycache__"]
|
||||||
ignore = []
|
ignore = []
|
||||||
defineConstant = { DEBUG = true }
|
defineConstant = { DEBUG = true }
|
||||||
|
|
|
@ -7,8 +7,8 @@ from services.rediscache import redis
|
||||||
|
|
||||||
async def handle_reaction(notification: dict[str, str | int]):
|
async def handle_reaction(notification: dict[str, str | int]):
|
||||||
"""создаеёт новое хранимое уведомление"""
|
"""создаеёт новое хранимое уведомление"""
|
||||||
try:
|
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
|
try:
|
||||||
n = Notification(**notification)
|
n = Notification(**notification)
|
||||||
session.add(n)
|
session.add(n)
|
||||||
session.commit(n)
|
session.commit(n)
|
||||||
|
@ -19,6 +19,6 @@ async def handle_reaction(notification: dict[str, str | int]):
|
||||||
|
|
||||||
async def reactions_worker():
|
async def reactions_worker():
|
||||||
async for message in redis.listen("reaction"):
|
async for message in redis.listen("reaction"):
|
||||||
msg = json.loads(message["data"])
|
msg = json.loads((await message).get("data", ""))
|
||||||
if msg:
|
if msg:
|
||||||
await handle_reaction(msg)
|
await handle_reaction(msg)
|
||||||
|
|
|
@ -24,13 +24,6 @@ class Notification:
|
||||||
occurrences: int
|
occurrences: int
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
|
||||||
class NotificationsQueryResult:
|
|
||||||
notifications: list[Notification]
|
|
||||||
unread: int
|
|
||||||
total: int
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class NotificationSeenResult:
|
class NotificationSeenResult:
|
||||||
error: str
|
error: str
|
||||||
|
@ -40,7 +33,7 @@ class NotificationSeenResult:
|
||||||
class NotificationsResult:
|
class NotificationsResult:
|
||||||
notifications: List[Notification]
|
notifications: List[Notification]
|
||||||
unread: int
|
unread: int
|
||||||
|
total: int
|
||||||
|
|
||||||
def notification_seen_by_viewer(viewer_id, notification_id, session):
|
def notification_seen_by_viewer(viewer_id, notification_id, session):
|
||||||
seen = (
|
seen = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user