feat(backend): who of the given people is online now in one request
This commit is contained in:
1 parent
9ae8b34005
commit
f62c345e2b
2 files changed
+34
No files matched your search
@@ -9,6 +9,7 @@ from api.timezone import checked_tz
|
||||
from utils.read import presence, presence_stats
|
||||
from utils.read.models import (
|
||||
DEFAULT_LIMIT,
|
||||
MAX_LIMIT,
|
||||
Page,
|
||||
PresenceHourly,
|
||||
PresenceSample,
|
||||
@@ -54,6 +55,16 @@ async def current_presence(
|
||||
return await presence.current_presence(pool, account_id, peer_id)
|
||||
|
||||
|
||||
@router.get("/online")
|
||||
async def online_now(
|
||||
pool: FromDishka[asyncpg.Pool],
|
||||
account_id: AccountId,
|
||||
peer_ids: Annotated[str, Query()],
|
||||
) -> list[PresenceSample]:
|
||||
parsed = [int(part) for part in peer_ids.split(",") if part.strip()]
|
||||
return await presence.online_now(pool, account_id, parsed[:MAX_LIMIT])
|
||||
|
||||
|
||||
@router.get("/hourly")
|
||||
async def presence_hourly(
|
||||
pool: FromDishka[asyncpg.Pool],
|
||||
|
||||
Reference in new issue
Block a user