feat(privacy): enforce avatar/presence visibility and invite restrictions

This commit is contained in:
2026-03-08 13:32:20 +03:00
parent eb0852e64d
commit c214cc8fd8
5 changed files with 113 additions and 8 deletions

View File

@@ -140,6 +140,16 @@ async def get_contact_relation(db: AsyncSession, *, user_id: int, contact_user_i
return result.scalar_one_or_none()
async def is_user_in_contacts(db: AsyncSession, *, owner_user_id: int, candidate_user_id: int) -> bool:
result = await db.execute(
select(UserContact.id).where(
UserContact.user_id == owner_user_id,
UserContact.contact_user_id == candidate_user_id,
).limit(1)
)
return result.scalar_one_or_none() is not None
async def list_contacts(db: AsyncSession, *, user_id: int) -> list[User]:
stmt = (
select(User)