Add pending chat requests CTA on mitra home screen
- Backend: new GET /api/mitra/chat-requests/pending endpoint - Backend: getPendingRequestsForMitra() queries unresponded notifications for sessions still in pending_acceptance status - Mitra app: loadPendingRequests() fetches on screen load + status toggle - Mitra app: activeRequestCount getter exposes queue size - Mitra app: _PendingRequestsBanner widget shows count with tap-to-view Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -307,6 +307,19 @@ export const expirePairingRequest = async (sessionId) => {
|
||||
return session
|
||||
}
|
||||
|
||||
export const getPendingRequestsForMitra = async (mitraId) => {
|
||||
const rows = await sql`
|
||||
SELECT cs.id AS session_id, cs.duration_minutes, cs.is_free_trial, cs.created_at
|
||||
FROM chat_request_notifications crn
|
||||
JOIN chat_sessions cs ON cs.id = crn.session_id
|
||||
WHERE crn.mitra_id = ${mitraId}
|
||||
AND crn.response IS NULL
|
||||
AND cs.status = ${SessionStatus.PENDING_ACCEPTANCE}
|
||||
ORDER BY cs.created_at ASC
|
||||
`
|
||||
return rows
|
||||
}
|
||||
|
||||
export const getSessionStatus = async (sessionId) => {
|
||||
const [session] = await sql`
|
||||
SELECT cs.id, cs.customer_id, cs.mitra_id, cs.status, cs.created_at, cs.paired_at, cs.ended_at, cs.ended_by,
|
||||
|
||||
Reference in New Issue
Block a user