@zooly/voice-chat-srv is a server-side package that provides API handlers for creating and updating voice call logs. It sits between the Next.js API routes and the @zooly/app-db access layer.
This package follows the same pattern as @zooly/app-srv — it receives a cookie header, resolves the user/account, and delegates to database access functions.
@zooly/voice-chat-srvpackages/voice-chat/srv@zooly/app-db — Database access layer (createVoiceCallLog, updateVoiceCallLogMessages, getAccountByUserId)@zooly/types — Shared types (VoiceCallLog, VoiceCallMessage)@zooly/util — Shared utilities (getVerifiedUserInfo)createVoiceCallLogHandlerasync function createVoiceCallLogHandler(
cookieHeader: string,
agentId: string
): Promise<VoiceCallLog>
getVerifiedUserInfo(cookieHeader)getAccountByUserId(userInfo.id)accountId and agentIdVoiceCallLog record (including generated id)updateVoiceCallLogHandlerasync function updateVoiceCallLogHandler(
id: string,
voiceCallMessages: VoiceCallMessage[]
): Promise<void>
Updates the voiceCallMessages JSON array and updatedAt timestamp for the given log ID.
The voice_call_log table is defined in @zooly/app-db:
| Column | Type | Description |
|---|---|---|
id | text (PK) | Auto-generated nanoid |
account_id | text | Nullable reference to the account |
agent_id | text | ElevenLabs agent ID (required) |
voice_call_messages | jsonb | Array of VoiceCallMessage objects |
created_at | timestamptz | Creation timestamp |
updated_at | timestamptz | Last update timestamp |
@zooly/app-db)createVoiceCallLog(accountId, agentId) — Insert a new logupdateVoiceCallLogMessages(id, messages) — Update messages and updatedAtgetVoiceCallLog(id) — Fetch a log by IDThe consuming app creates thin route handlers that delegate to these handlers. See App Integration for the zooly-app routes.
| Route | Method | Handler |
|---|---|---|
/api/voice-call-log/create | POST | createVoiceCallLogHandler |
/api/voice-call-log/update | PUT | updateVoiceCallLogHandler |