Database Schema

Overview

FaceKom uses PostgreSQL as its primary database with Sequelize ORM (custom @techteamer/sequelize fork v6.30.1). vuer_oss defines 55+ models and esign defines 27 models in separate databases.

vuer_oss Models (55+)

Entity Relationship Diagram

erDiagram
    User ||--o{ Room : creates
    User ||--o{ AuditLog : generates
    User ||--o{ EmailLog : sends
    User ||--o{ SmsLog : sends
    User ||--o{ Download : requests

    Customer ||--o{ Room : participates
    Customer ||--o{ SelfServiceRoom : starts
    Customer ||--o{ CustomerHistory : has
    Customer ||--o{ CallbackRequest : makes
    Customer ||--o{ Document : owns
    Customer ||--o{ Encryption : has
    Customer ||--o{ CustomerValidation : has
    Customer ||--o{ CustomerDataChange : tracks

    Room ||--o{ Activity : logs
    Room ||--o{ Feedback : receives
    Room ||--o{ MediaFile : records
    Room ||--o{ Document : contains
    Room ||--o{ CommunicationLog : logs
    Room ||--o{ Encryption : uses
    Room ||--o{ ClientErrorLog : logs
    Room ||--o{ Flow : executes

    SelfServiceRoom ||--o{ Activity : logs
    SelfServiceRoom ||--o{ Flow : executes
    SelfServiceRoom ||--o{ MediaFile : records
    SelfServiceRoom ||--o{ Document : contains

    Flow ||--o{ Task : contains
    Flow }o--|| FlowProto : "instance of"
    Flow }o--o| Flow : "parent"
    Task }o--|| TaskProto : "instance of"

    MediaFile }o--|| Encryption : "encrypted by"
    Attachment }o--|| Encryption : "encrypted by"
    Document }o--|| Attachment : has

Identity & Access

ModelPurposeKey Relationships
UserOperator usershas many: Room, EmailLog, SmsLog, ClientErrorLog, Download, AuditLog
CustomerEnd customershas many: Room, SelfServiceRoom, CustomerHistory, CallbackRequest, EmailLog, SmsLog, ClientErrorLog, Document, Encryption, Download
SessionSession storageconnect-session-sequelize
PasswordHistoryPassword rotation policiesbelongs to User
WebAuthnCredentialFIDO2/WebAuthn credentialsbelongs to User
TotpKeyTOTP two-factor auth keysbelongs to User
OneTimeLoginOne-time login tokensbelongs to User

Verification Sessions

ModelPurposeKey Relationships
RoomVideo call roomsbelongs to Customer, User; has many: Activity, Feedback, MediaFile, Document, CommunicationLog, Encryption, ClientErrorLog, Flow
SelfServiceRoomSelf-service sessionsbelongs to Customer; same relations as Room

Workflow Engine

ModelPurposeKey Relationships
FlowWorkflow instancesbelongs to FlowProto, Customer, Room, SelfServiceRoom, parentFlow; created/started/updated/finishedBy User
FlowProtoWorkflow templateshas many Flow
TaskIndividual workflow tasksbelongs to Flow, TaskProto
TaskProtoTask templateshas many Task
FlowActivityWorkflow activity logbelongs to Flow
FlowScopeWorkflow variable scopesbelongs to Flow
FlowResultWorkflow resultsbelongs to Flow
FlowTranslationWorkflow i18nbelongs to FlowProto

Documents & Media

ModelPurposeKey Relationships
AttachmentFile attachmentsbelongs to Encryption, TimestampToken
MediaFileMedia recordingsbelongs to Encryption, Room, SelfServiceRoom, ImportedRoom, TimestampToken
DocumentCustomer documentsbelongs to Customer, Room, SelfServiceRoom, Attachment
DocumentVersionDocument version historybelongs to Document
SystemDocumentSystem-level documents
EncryptionEncryption metadata for filesbelongs to Customer

Recognition & CV

ModelPurposeKey Relationships
FaceRecognitionFace recognition records
FaceComparisonFace comparison records
RecognitionAttemptRecognition attempt logs
EmrtdInfoeMRTD (electronic passport) data

Communication

ModelPurposeKey Relationships
CommunicationLogWebRTC communication logsbelongs to Room
ClientErrorLogClient-side error logsbelongs to User, Customer, Room, SelfServiceRoom
EmailLogEmail send logsbelongs to User, Customer
SmsLogSMS send logsbelongs to User, Customer
FeedbackCustomer/operator feedbackbelongs to Room

Admin & Audit

ModelPurposeKey Relationships
AuditLogAudit trailbelongs to User, targetUser
ActivitySystem activity logbelongs to Room, SelfServiceRoom, User, Customer, encryptionCustomer
UserActivityUser-specific activity logbelongs to User
IntegrationLogAPI integration audit logs
JanusEventJanus WebRTC gateway events

Configuration

ModelPurposeKey Relationships
SettingSystem settings
OpenHourStandardStandard business hours
OpenHourExceptionBusiness hour exceptions
CertTLS certificates
ShortenerURL shortener
TimestampTokenTimestamp tokens (RFC 3161)

Business

ModelPurposeKey Relationships
JobBackground jobs
BackgroundProcessBackground processingbelongs to 18 different models (polymorphic)
BackgroundProcessLogBackground process logsbelongs to BackgroundProcess
CallbackRequestCallback schedulingbelongs to Customer
CallbackRequestActivityCallback activity logbelongs to CallbackRequest
PartnerPartner organizationshas many PartnerService
PartnerServicePartner service definitionshas many PartnerServiceRequest
PartnerServiceRequestPartner service requestsbelongs to PartnerService
CustomerHistoryCustomer event historybelongs to Customer
CustomerValidationCustomer data validationbelongs to Customer
CustomerDataChangeCustomer data change trackingbelongs to Customer, with User scope
DownloadDownload trackingbelongs to User, Customer
StorageStorage location records

Data Import

ModelPurpose
ImportedCustomerImported customer records
ImportedRoomImported room/session records
ImportedFlowImported workflow records
ImportedFlowTranslationImported flow translations

BackgroundProcess Polymorphism

BackgroundProcess has belongsTo associations with 18 different models — it acts as a polymorphic catch-all for tracking long-running operations across the entire system.

esign_oss Models (27)

Entity Relationship Diagram

erDiagram
    Customer ||--o{ Contract : has
    Customer ||--o{ Offer : has
    Customer ||--o{ Activity : logs
    Customer ||--o{ CustomerData : has
    Customer ||--o{ VerificationToken : has
    Customer ||--o{ App : owns

    Contract ||--o{ Document : contains
    Offer ||--o{ Signature : has

    Signature ||--o{ SignatureData : contains
    Signature ||--o| SignatureValidation : validates

    App ||--o| Device : "installed on"
    App ||--o| FcmInfo : "push config"

Core Models

ModelPurpose
CustomerEnd customers
ContractSigned contracts
DocumentContract documents
OfferOffers pending signature
SignatureDigital signatures
SignatureDataSignature binary data
SignatureValidationSignature verification results
CustomerDataCustomer personal data
VerificationToken2FA tokens

Supporting Models

ModelPurpose
UserAdmin/operator users
AuditLogAudit trail
EmailLogEmail delivery logs
SmsLogSMS delivery logs
ActivityCustomer activity log
SettingSystem settings
ShortenerURL shortener
ClientErrorLogClient-side errors
CertCertificate storage
BackgroundProcessBackground jobs
BackgroundProcessLogBackground job logs
TimestampTokenRFC 3161 timestamps
AttachmentFile attachments
SessionWeb sessions
AppMobile app registrations
DeviceCustomer devices
FcmInfoFirebase push notification config

SmsLog Foreign Key Hack

SmsLog.belongsTo(CustomerData, { as: 'customerData', foreignKey: 'customerId', sourceKey: 'customerId' }) — uses customerId as a cross-reference instead of a proper foreign key association.

Database Configuration

PropertyValue
ORMSequelize (custom @techteamer/sequelize fork v6.30.1)
Primary DBPostgreSQL 16.6
Also supportedMySQL (utf8mb4), MSSQL (tedious), Oracle 12g
vuer_oss databasevuer_oss
esign_oss databaseesign_oss
Test databasevuer_oss_test
Migrationsdb/migrate/ using Umzug, timestamp-numbered
Config files.sequelize-config.js, .sequelizerc, .sequelizercBefore

Key Relationships

User 1--* Room *--1 Customer
Customer 1--* SelfServiceRoom
Room/SelfServiceRoom 1--* Activity
Room/SelfServiceRoom 1--* Flow 1--* Task
Room/SelfServiceRoom 1--* MediaFile *--1 Encryption
Room/SelfServiceRoom 1--* Document *--1 Attachment *--1 Encryption
Customer 1--* CustomerHistory
Customer 1--* CustomerValidation
Customer 1--* CustomerDataChange
Flow *--1 FlowProto
Task *--1 TaskProto
Flow *--1 parentFlow (self-referencing)