Реал-тайм через SSE (push-to-invalidate): живые приглашения/партии, авто-обновление без перезагрузки
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ from app.auth.deps import get_current_user
|
||||
from app.db.session import get_session
|
||||
from app.models import User
|
||||
from app.schemas import api as s
|
||||
from app.services import invitation_service
|
||||
from app.services import invitation_service, notify
|
||||
|
||||
router = APIRouter(prefix="/invitations", tags=["invitations"])
|
||||
|
||||
@@ -27,7 +27,9 @@ def accept_invitation(
|
||||
session: Session = Depends(get_session),
|
||||
user: User = Depends(get_current_user),
|
||||
) -> s.OkResponse:
|
||||
invitation_service.accept(session, user, invitation_id)
|
||||
group = invitation_service.accept(session, user, invitation_id)
|
||||
notify.invitations_changed(user.id) # type: ignore[arg-type]
|
||||
notify.group_changed(session, group.id) # type: ignore[arg-type] # новый участник
|
||||
return s.OkResponse()
|
||||
|
||||
|
||||
@@ -38,4 +40,5 @@ def decline_invitation(
|
||||
user: User = Depends(get_current_user),
|
||||
) -> s.OkResponse:
|
||||
invitation_service.decline(session, user, invitation_id)
|
||||
notify.invitations_changed(user.id) # type: ignore[arg-type]
|
||||
return s.OkResponse()
|
||||
|
||||
Reference in New Issue
Block a user