Feat(api) - migrate post chat read
Merged
AH
5mo ago+408+408+012345678901234567890123456789-0-0-0123456789
Summary by cubic
Adds POST /api/sessions/:sessionId/chats/:chatId/read to mark a chat as read for the authenticated account and respond with { success: true }. Auth via Privy bearer token or x-api-key, validates ownership, and upserts chat_reads.last_read_at.
-
New Features
- CORS preflight; no cache (
force-dynamic,force-no-store). - Validation: session owned by account; chat belongs to session (403/404 on failure).
- Idempotent persistence via
upsertChatRead(accountId, chatId). - Consistent JSON errors with proper status codes.
- CORS preflight; no cache (
-
Refactors
- Simplified request creation in handler and validator tests; no behavior change.
Summary by CodeRabbit
Release Notes
- New Features
- Users can now mark individual chats as read, with the system automatically tracking and recording the timestamp of when each chat was last viewed.
- Read status requests are validated and authenticated with proper security checks to ensure data integrity, maintain user privacy, and prevent unauthorized modifications.