feat: add online presence tracking with last_seen column and configurable timeout
Add `last_seen` column to users table with index, implement `set_last_seen` and `get_online_users` database functions, expose presence config env vars (`PRESENCE_TIMEOUT_SECONDS`, `PRESENCE_ONLINE_LIMIT`, `PRESENCE_ONLINE_MARGIN_SECONDS`), include `last_seen` in follow list responses, and update profile docs to mention online indicator.
This commit is contained in:
@@ -19,6 +19,7 @@ class UserOut(_Out):
|
||||
xp: Optional[int] = None
|
||||
stars: Optional[int] = None
|
||||
created_at: Optional[str] = None
|
||||
last_seen: Optional[str] = None
|
||||
|
||||
|
||||
class AttachmentOut(_Out):
|
||||
|
||||
@@ -113,6 +113,7 @@ class FeedOut(_Out):
|
||||
total_gists: Optional[int] = None
|
||||
top_authors: list[UserOut] = []
|
||||
daily_topic: Optional[Any] = None
|
||||
online_users: list[UserOut] = []
|
||||
|
||||
|
||||
class PostDetailOut(_Out):
|
||||
|
||||
@@ -40,6 +40,7 @@ class ProfileOut(_Out):
|
||||
is_blocked: bool = False
|
||||
is_muted: bool = False
|
||||
is_owner: bool = False
|
||||
profile_online: bool = False
|
||||
can_view_api_key: bool = False
|
||||
api_key: Optional[str] = None
|
||||
ai_correction_enabled: bool = False
|
||||
|
||||
Reference in New Issue
Block a user