Data Model: hbf-lcg
Database
MySQL/MariaDB, database name: lcm (shared with hbf-lcm, different tables).
ER Diagram
Entities
LiveChatSession
Table: live_chat_session
File: src/entities/session.entity.ts
Tracks active livechat sessions between a subscriber and an external provider. Generic over Plugin<T> to store provider-specific configuration in the plugin JSON column.
| Column | Type | Notes |
|---|---|---|
| id | int | PK, auto-increment |
| subscriberHandle | string | Indexed. Identifies the end user. |
| externalServiceSessionId | string | Indexed. Session ID in the external system. |
| externalConversationId | string | Nullable, indexed. Conversation ID (some providers). |
| organizationId | string | HBF organization ID. |
| tenantId | string | HBF tenant ID. |
| integrationType | string | Provider alias (helvia-livechat, cisco-livechat, etc.). |
| status | SubscriberStatus | NONE, ACTIVE, or PENDING. |
| setCookies | string | Nullable. Stored cookies for provider sessions. |
| createdAt | datetime | Auto-set on creation. |
| acceptedAt | datetime | Nullable. Set when agent accepts the request. |
| lastActivity | datetime | Auto-set, updated on activity. |
| plugin | json | Nullable. Provider-specific Plugin config. |
CiscoEvent
Table: cisco_event
File: src/entities/cisco-event.entity.ts
Deduplicates events received via Cisco polling. Unique constraint on (livechatSession, eventId) prevents processing the same event twice.
| Column | Type | Notes |
|---|---|---|
| id | int | PK, auto-increment |
| eventId | int | Event ID from Cisco |
| eventType | CiscoEventType | Default: TypingEvent |
| status | string | Nullable |
| livechatSession | LiveChatSession | ManyToOne, CASCADE delete |
Enums
SubscriberStatus
| Value | Meaning |
|---|---|
| NONE | No active session |
| ACTIVE | Session accepted, conversation in progress |
| PENDING | Request created, waiting for agent acceptance |
CiscoEventType
| Value | Meaning |
|---|---|
| TypingEvent | Default. Agent typing indicator. |
Migrations
| File | Date | Summary |
|---|---|---|
1718189673885-Init.ts | 2024-06 | Create live_chat_session and cisco_event tables |
1720432889736-AddSessionConversationId.ts | 2024-07 | Add externalConversationId, lastActivity; make setCookies nullable |
1761818418752-AddCiscoEventTypeAndStatus.ts | 2025-03 | Add eventType and status to cisco_event |
1764241635781-AddPluginLiveChatSession.ts | 2025-03 | Add plugin JSON column to live_chat_session |