mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
GET /api/insights/chat returns the caller's conversations newest-first with cursor pagination (default limit 20, hard cap 50). Each row carries id, title, timestamps, and a message count so the rail can render without paying the per-message decrypt cost. GET /api/insights/chat/[id] fetches one conversation with every message decrypted in memory before serialisation. Provenance metadata round-trips alongside the assistant turns. DELETE /api/insights/chat/[id] hard-deletes the thread; the FK chain cascades the message rows. Cross-user lookups map to 404, never 403, so the existence channel never leaks across accounts. 6 integration tests cover the list ordering, owner-only filter, decryption round-trip, and the 404 boundary on both verbs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>