KnowledgeBase + KnowledgeBaseArticle
A knowledge base is a collection of articles shared across Tenants within an Organization. Articles are multilingual. Collection (KB):
knowledge-bases| Collection (Article):knowledge-base-articles| DB: MongoDB Source (KB):hbf-core/src/main/java/gr/helvia/hbf/core/domain/KnowledgeBase.ktSource (Article):hbf-core/src/main/java/gr/helvia/hbf/core/domain/KnowledgeBaseArticle.ktTypeScript (KB):hbf-core-api/src/datamodel/knowledgeBase.tsTypeScript (Article):hbf-core-api/src/datamodel/knowledgeBaseArticle.ts
KnowledgeBase Fields
| Field | Type | Required | Indexed | Notes |
|---|---|---|---|---|
id | String | yes | PK | MongoDB document ID |
name | String | yes | ||
organization | Organization | yes | @DBRef lazy | |
tenantAssociations | Set<TenantAssociation> | no | Tenants using this KB | |
description | String | no | ||
image | String | no | ||
languages | Set<KnowledgeBaseLanguage> | no | ||
integration | Integration | no | @DBRef lazy, for backward compat | |
type | KnowledgeBaseType | yes | Default: INTERNAL | |
source | String | no | ||
spaces | Set<Space> | no | ||
totalArticles | Int | no | @Transient, computed | |
createdBy | HashMap<String, String?> | no | ||
createdAt | Date | yes | @CreatedDate | |
version | Int | no | From Versioned trait | |
lastModifiedAt | Date | no | From Versioned | |
lastModifiedBy | HashMap<String, String?> | no | From Versioned |
KnowledgeBase Nested Objects
TenantAssociation
| Field | Type | Notes |
|---|---|---|
tenant | Tenant | @DBRef lazy |
useGenerative | Boolean | Whether to use generative AI for responses |
KnowledgeBaseLanguage
| Field | Type | Notes |
|---|---|---|
languageCode | LanguageCode | |
isPrimary | Boolean |
KnowledgeBaseArticle Fields
| Field | Type | Required | Indexed | Notes |
|---|---|---|---|---|
id | String | yes | PK | MongoDB document ID |
ordinal | Int | no | Ordering within group | |
externalId | String | no | Integration-specific ID | |
status | KnowledgeBaseArticleStatus | yes | Default: PUBLISHED | |
content | Set<ArticleContent> | yes | One per language | |
group | KnowledgeBaseGroup | no | @DBRef lazy | |
knowledgeBase | KnowledgeBase | yes | @DBRef lazy | |
organization | Organization | yes | @DBRef lazy | |
createdAt | Date | yes | @CreatedDate | |
version | Int | no | From Versioned | |
lastModifiedAt | Date | no | From Versioned | |
lastModifiedBy | HashMap<String, String?> | no | From Versioned |
ArticleContent
| Field | Type | Notes |
|---|---|---|
languageCode | LanguageCode | |
title | String | Max 1024 characters |
tags | List<String> | |
body | String | Article body (markdown/HTML) |
Enums
KnowledgeBaseType
| Value | Description |
|---|---|
INTERNAL | Manually created KB |
INTEGRATION | Synced from external system (e.g., MS Dynamics) |
SHARED | Shared across organizations |
KnowledgeBaseArticleStatus
| Value | Description |
|---|---|
PUBLISHED | Visible and active |
UNPUBLISHED | Draft or hidden |
Relationships
- KnowledgeBase belongs to: Organization (via @DBRef)
- KnowledgeBase associated with: Multiple Tenants (via TenantAssociation with useGenerative flag)
- KnowledgeBase can reference: Integration (for synced KBs)
- KnowledgeBaseArticle belongs to: KnowledgeBase, KnowledgeBaseGroup, Organization (all via @DBRef)
- ArticleContent is multilingual (one per language per article)
TypeScript Mapping
| hbf-core (Kotlin) | hbf-core-api (TypeScript) | Notes |
|---|---|---|
| KnowledgeBase | KnowledgeBase | TS uses tenantAssociationRefs (with tenantId string) vs Kotlin's @DBRef. TS adds integrationId, status, sdsJobId |
| KnowledgeBaseArticle | KnowledgeBaseArticleDto | TS uses groupId string vs Kotlin's @DBRef. TS omits externalId, status, organization |
| ArticleContent | ArticleContent | Aligned. TS fields are optional |
| KnowledgeBaseLanguage | KnowledgeBaseLanguage | Aligned |
| KnowledgeBaseType | KnowledgeBaseType | Aligned |
| TenantAssociation | TenantAssociationRef | TS uses tenantId string instead of @DBRef |
| KnowledgeBaseArticleStatus | (not in TS) | Gap |