Skip to main content

Data Models Overview

This section describes all data models used across the API, including database entities, request DTOs, and response DTOs.

Entity Relationship

┌─────────────┐ ┌──────────────────┐ ┌──────────────┐
│ Workspace │──────▶│ WorkspaceMember │◀──────│ User │
│ │ │ │ │ │
│ - id │ │ - workspaceId │ │ - id │
│ - name │ │ - userId │ │ - email │
│ - ownerId │ │ - role │ │ - name │
└──────┬───────┘ └──────────────────┘ └──────┬───────┘
│ │
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Document │──────▶│ CommentThread │──────▶│ Comment │
│ │ │ │ │ │
│ - id │ │ - documentId │ │ - threadId │
│ - title │ │ - anchor │ │ - userId │
│ - content │ │ - status │ │ - content │
│ - parentId │ └──────────────────┘ └──────────────────┘
│ - workspaceId│
└──────┬───────┘


┌──────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Attachment │ │ Notification │ │WorkspaceInvitation│
│ │ │ │ │ │
│ - documentId│ │ - recipientId │ │ - workspaceId │
│ - fileName │ │ - type │ │ - email │
│ - storageKey│ │ - status │ │ - token │
└──────────────┘ └──────────────────┘ └──────────────────┘

Core Entities

EntityDescriptionKey Fields
UserApplication userid, email, name, firebaseUid, status
WorkspaceOrganizational containerid, name, ownerId, slug
DocumentWiki document with hierarchical structureid, title, content (JSONB), parentId, yjsState
WorkspaceMemberUser membership in workspaceworkspaceId, userId, role
WorkspaceInvitationPending invitationemail, role, token, expiresAt
CommentThreadComment thread on a documentdocumentId, anchor (JSONB), status
CommentIndividual commentthreadId, userId, content
NotificationUser notificationrecipientId, type, status, metadata (JSONB)
AttachmentFile attachmentdocumentId, storageKey, fileName
UserPreferenceUser settingsuserId, theme, locale

ID Strategy

All entities use UUID as primary key. Foreign keys are stored as UUID references (no JPA relationship annotations).

Timestamps

All entities extend BaseEntity which provides:

  • createdAt - Auto-set on creation
  • updatedAt - Auto-updated on modification