fix(backend): person overview reads live in their own module, no import cycle with read receipts

This commit is contained in:
hh committed 2026-10-19 02:57:49 +00:00
1 parent 1abb396c36
commit 0dd14c5d5e
4 files changed
+202 -200

No files matched your search

+3 -2
View File
@@ -25,6 +25,7 @@ from utils.read import (
chats,
media,
peers,
people,
presence,
presence_stats,
social,
@@ -397,8 +398,8 @@ async def get_person(account_id: int, peer_id: int) -> dict[str, Any]:
of their deleted messages, and the private chat if there is one.
"""
pool = await _pool()
overview = await peers.get_overview(pool, account_id, peer_id)
groups = await peers.get_groups(pool, account_id, peer_id)
overview = await people.get_overview(pool, account_id, peer_id)
groups = await people.get_groups(pool, account_id, peer_id)
return {**overview.model_dump(mode="json"), **groups.model_dump(mode="json")}
+4 -4
View File
@@ -4,7 +4,7 @@ import asyncpg
from dishka.integrations.fastapi import DishkaRoute, FromDishka
from fastapi import APIRouter, HTTPException, Query
from utils.read import peers
from utils.read import peers, people
from utils.read.models import (
PeerGroups,
PeerHistoryView,
@@ -47,18 +47,18 @@ async def peer_history(
async def peer_overview(
pool: FromDishka[asyncpg.Pool], peer_id: int, account_id: AccountId
) -> PeerOverview:
return await peers.get_overview(pool, account_id, peer_id)
return await people.get_overview(pool, account_id, peer_id)
@router.get("/peers/{peer_id}/groups")
async def peer_groups(
pool: FromDishka[asyncpg.Pool], peer_id: int, account_id: AccountId
) -> PeerGroups:
return await peers.get_groups(pool, account_id, peer_id)
return await people.get_groups(pool, account_id, peer_id)
@router.get("/chats/{chat_id}/changes")
async def chat_changes(
pool: FromDishka[asyncpg.Pool], chat_id: int, account_id: AccountId
) -> list[ProfileChange]:
return await peers.get_chat_changes(pool, account_id, chat_id)
return await people.get_chat_changes(pool, account_id, chat_id)