feat: Implement recent chats feature with API endpoint and UI integration

This commit is contained in:
Andre Beging
2025-10-07 15:08:33 +02:00
parent 85094f8683
commit ddf29c1d36
7 changed files with 682 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ from .models import (
LoginStartRequest,
LoginVerifyRequest,
MessageTriggerResponse,
RecentChat,
StatusResponse,
)
from .storage import (
@@ -136,6 +137,14 @@ async def list_hooks() -> List[HookResponse]:
]
@app.get("/api/recent-chats", response_model=List[RecentChat])
async def recent_chats() -> List[RecentChat]:
if not await telegram_service.is_authorized():
raise HTTPException(status_code=401, detail="Session not authorized")
chats = await telegram_service.fetch_recent_chats()
return chats
@app.post("/api/hooks", response_model=HookResponse, status_code=201)
async def create_hook(payload: HookCreate) -> HookResponse:
hook = await create_hook_async(payload)