Skip to content

Category Management Services

Last Updated: 2026-05-08

The category services manage the organizational hierarchy of the Knowledge Hub.

Service Layering

CategoryOrchestrator

High-level business logic coordinator.

  • Responsibility: Category CRUD workflows, Notion sync coordination
  • Pattern: Orchestrator Pattern — delegates to Resolution, Persistence, and Sync services
  • Pipeline: Resolve → Map → Persist → Sync (best-effort)

CategoryPersistenceService

Low-level data access.

  • Responsibility: CRUD operations on the Category entity via Doctrine repository
  • Pattern: Extends BasePersistenceService<Category, CategoryRepository>
  • Rule: Always final class, receives repository via injection (not EntityManager)

CategoryQueryService

Read-only queries.

  • Responsibility: Find by ID, Notion ID, name; list all active categories
  • Pattern: Extends BaseQueryService<Category, CategoryRepository>
  • Rule: Read-only — no mutations, no flush/persist

CategoryResolutionService

Entity resolution from opaque identifiers.

  • Responsibility: Normalize IDs, check local DB, name lookup
  • Pattern: Extends BaseResolutionService (Strategy Pattern: ID, NotionID, Name)
  • Rule: Read-only, must NOT use PersistenceService

Business Logic

Digest Settings

Categories support configurable digest settings:

  • Frequency: weekly (7d), biweekly (14d), monthly (30d), quarterly (90d)
  • Day of week: 1-7 (Monday-Sunday)
  • Time: HH:MM format

Activation

Deactivating a category (isActive = false):

  • Hides it from the Slack App Home
  • Excludes it from automatic sync cycles
  • Preserves historical associations for existing knowledge items

Notion Sync

Categories sync bidirectionally via NotionSyncService:

  • Local changes → Notion page properties
  • Notion changes → Local entity updates
  • Uses notionLastEditedAt for change detection