Реал-тайм через SSE (push-to-invalidate): живые приглашения/партии, авто-обновление без перезагрузки

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 22:52:41 +03:00
co-authored by Claude Opus 4.8
parent 16452f7bbe
commit 2500ca575b
15 changed files with 357 additions and 9 deletions
+7
View File
@@ -16,6 +16,7 @@ from app.services import (
audit_service,
group_service,
match_service,
notify,
user_service,
)
from app.services.match_service import FinishInput, ParticipantInput, RosterInput
@@ -119,6 +120,7 @@ def start_match(
user_agent=request.headers.get("user-agent"),
)
session.commit()
notify.match_changed(session, match)
return build_match_read(session, match, can_modify=match_service.can_modify(session, match, user))
@@ -157,6 +159,7 @@ def finish_match(
user_agent=request.headers.get("user-agent"),
)
session.commit()
notify.match_changed(session, match)
return build_match_read(session, match, can_modify=match_service.can_modify(session, match, user))
@@ -214,6 +217,7 @@ def update_match(
user_agent=request.headers.get("user-agent"),
)
session.commit()
notify.match_changed(session, match)
return build_match_read(session, match, can_modify=match_service.can_modify(session, match, user))
@@ -243,6 +247,7 @@ def add_attachment(
att = attachment_service.add_photo(
session, match, user, content, ext, user_service.avatar_media_type(ext)
)
notify.match_changed(session, match)
return attachment_read(att, f"/api/matches/{match_id}")
@@ -256,6 +261,7 @@ def delete_attachment(
match = match_service.get_match(session, match_id)
_assert_can_attach(session, match, user)
attachment_service.delete(session, match, attachment_id)
notify.match_changed(session, match)
return s.OkResponse()
@@ -301,4 +307,5 @@ def delete_match(
user_agent=request.headers.get("user-agent"),
)
session.commit()
notify.match_removed(session, match_id_val, group_id_val) # type: ignore[arg-type]
return s.OkResponse()