Survey
Survey responses collected from a ChatSession. Stores question-answer pairs from interviews, live chats, or user feedback flows. Collection:
surveys| DB: MongoDB Source:hbf-core/src/main/java/gr/helvia/hbf/core/domain/Survey.ktTypeScript:hbf-core-api/src/datamodel/survey.ts
Fields
| Field | Type | Required | Indexed | Notes |
|---|---|---|---|---|
id | String | yes | PK | MongoDB document ID |
tenantId | String | yes | ||
organizationId | String | yes | ||
session | String | no | Deprecated. Kept for backward references | |
chatSession | ChatSession | no | @DBRef lazy | |
subscriber | String | yes | Subscriber ID | |
questions | List<SurveyQuestion> | yes | ||
createdAt | Date | yes | @CreatedDate | |
updatedAt | Date | yes | @LastModifiedDate | |
type | SurveyType | no |
Nested Objects
SurveyQuestion
| Field | Type | Notes |
|---|---|---|
questionId | String | |
question | String | Question text |
answer | String | User's answer |
sourceActivityName | String | Optional. Activity that generated this question |
Enums
SurveyType
| Value | Description |
|---|---|
INTERVIEW | From interview flow |
LIVECHAT | From live chat flow |
USER_FEEDBACK | From user feedback flow |
Relationships
- Belongs to: Tenant (via tenantId), Organization (via organizationId)
- References: ChatSession (via @DBRef)
- References: Subscriber (via subscriber string ID)
TypeScript Mapping
| hbf-core (Kotlin) | hbf-core-api (TypeScript) | Notes |
|---|---|---|
| Survey | Survey | TS omits organizationId. TS uses chatSession as optional ChatSessionDTO |
| SurveyQuestion | Question | Different naming |
| SurveyType | SurveyType (const enum) | Aligned |
| (not in Kotlin) | SurveyForm | TS-only write model (Partial<Survey>) |