feat: log presence, read receipts, group leaves, links, profiles, stories

This commit is contained in:
h
2026-05-29 22:13:59 +02:00
parent bfd16ab02c
commit bcb94b6474
31 changed files with 1298 additions and 19 deletions
@@ -0,0 +1,48 @@
import asyncpg
_INSERT_AVATAR = """
INSERT INTO avatars
(account_id, owner_id, owner_kind, unique_id, storage_key, file_size, mime,
downloaded, raw)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9::jsonb)
ON CONFLICT (account_id, owner_id, unique_id) DO NOTHING
"""
_EXISTS = """
SELECT 1 FROM avatars
WHERE account_id = $1 AND owner_id = $2 AND unique_id = $3
"""
async def avatar_exists(
pool: asyncpg.Pool, account_id: int, owner_id: int, unique_id: str
) -> bool:
row = await pool.fetchval(_EXISTS, account_id, owner_id, unique_id)
return row is not None
async def insert_avatar( # noqa: PLR0913
pool: asyncpg.Pool,
account_id: int,
owner_id: int,
owner_kind: str,
unique_id: str,
storage_key: str | None,
file_size: int | None,
mime: str | None,
raw: str,
*,
downloaded: bool,
) -> None:
await pool.execute(
_INSERT_AVATAR,
account_id,
owner_id,
owner_kind,
unique_id,
storage_key,
file_size,
mime,
downloaded,
raw,
)