Skip to main content

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.kt Source (Article): hbf-core/src/main/java/gr/helvia/hbf/core/domain/KnowledgeBaseArticle.kt TypeScript (KB): hbf-core-api/src/datamodel/knowledgeBase.ts TypeScript (Article): hbf-core-api/src/datamodel/knowledgeBaseArticle.ts

KnowledgeBase Fields

FieldTypeRequiredIndexedNotes
idStringyesPKMongoDB document ID
nameStringyes
organizationOrganizationyes@DBRef lazy
tenantAssociationsSet<TenantAssociation>noTenants using this KB
descriptionStringno
imageStringno
languagesSet<KnowledgeBaseLanguage>no
integrationIntegrationno@DBRef lazy, for backward compat
typeKnowledgeBaseTypeyesDefault: INTERNAL
sourceStringno
spacesSet<Space>no
totalArticlesIntno@Transient, computed
createdByHashMap<String, String?>no
createdAtDateyes@CreatedDate
versionIntnoFrom Versioned trait
lastModifiedAtDatenoFrom Versioned
lastModifiedByHashMap<String, String?>noFrom Versioned

KnowledgeBase Nested Objects

TenantAssociation

FieldTypeNotes
tenantTenant@DBRef lazy
useGenerativeBooleanWhether to use generative AI for responses

KnowledgeBaseLanguage

FieldTypeNotes
languageCodeLanguageCode
isPrimaryBoolean

KnowledgeBaseArticle Fields

FieldTypeRequiredIndexedNotes
idStringyesPKMongoDB document ID
ordinalIntnoOrdering within group
externalIdStringnoIntegration-specific ID
statusKnowledgeBaseArticleStatusyesDefault: PUBLISHED
contentSet<ArticleContent>yesOne per language
groupKnowledgeBaseGroupno@DBRef lazy
knowledgeBaseKnowledgeBaseyes@DBRef lazy
organizationOrganizationyes@DBRef lazy
createdAtDateyes@CreatedDate
versionIntnoFrom Versioned
lastModifiedAtDatenoFrom Versioned
lastModifiedByHashMap<String, String?>noFrom Versioned

ArticleContent

FieldTypeNotes
languageCodeLanguageCode
titleStringMax 1024 characters
tagsList<String>
bodyStringArticle body (markdown/HTML)

Enums

KnowledgeBaseType

ValueDescription
INTERNALManually created KB
INTEGRATIONSynced from external system (e.g., MS Dynamics)
SHAREDShared across organizations

KnowledgeBaseArticleStatus

ValueDescription
PUBLISHEDVisible and active
UNPUBLISHEDDraft 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
KnowledgeBaseKnowledgeBaseTS uses tenantAssociationRefs (with tenantId string) vs Kotlin's @DBRef. TS adds integrationId, status, sdsJobId
KnowledgeBaseArticleKnowledgeBaseArticleDtoTS uses groupId string vs Kotlin's @DBRef. TS omits externalId, status, organization
ArticleContentArticleContentAligned. TS fields are optional
KnowledgeBaseLanguageKnowledgeBaseLanguageAligned
KnowledgeBaseTypeKnowledgeBaseTypeAligned
TenantAssociationTenantAssociationRefTS uses tenantId string instead of @DBRef
KnowledgeBaseArticleStatus(not in TS)Gap