feat: Implement recent chats feature with API endpoint and UI integration
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user