This commit is contained in:
2026-11-06 20:40:12 +03:00
parent 65003b6119
commit 7329d94740
31 changed files with 1662 additions and 4 deletions
+31
View File
@@ -0,0 +1,31 @@
from uuid import UUID
from .timeutil import fmt_dt
def user_json(row) -> dict:
return {
"id": str(row["id"]),
"username": row["username"],
"display_name": row["display_name"],
"created_at": fmt_dt(row["created_at"]),
}
def chat_json(row, member_ids: list[UUID]) -> dict:
return {
"id": str(row["id"]),
"title": row["title"],
"member_ids": [str(x) for x in member_ids],
"created_at": fmt_dt(row["created_at"]),
}
def message_json(row) -> dict:
return {
"id": str(row["id"]),
"chat_id": str(row["chat_id"]),
"sender_id": str(row["sender_id"]),
"text": row["text"],
"created_at": fmt_dt(row["created_at"]),
}