UserPreference

src/UserPreference/ manages per-user UI preferences: accent color and sidebar configuration. These are lightweight settings that control frontend appearance and are stored per-user.

This is the simplest bounded context in the codebase. It has no commands or query handlers — controllers call port interfaces directly.

Domain Models

Aggregate Root: SidebarConfig

Represents a user's sidebar item ordering and visibility.

Property Description
userId The user who owns this configuration
items Ordered collection of SidebarItem entries
updatedAt Last modification timestamp

Model: SidebarItem

An individual sidebar entry.

Property Description
label Display label for the sidebar item
icon Icon identifier
route Frontend route the item navigates to
order Position in the sidebar
visible Whether the item is shown

SidebarItem is a model rather than a value object because it has identity within the SidebarConfig aggregate.

Commands & Handlers

This context does not use CQRS. Controllers call port interfaces directly for both reads and writes. This is intentional — the operations are simple key-value lookups that do not warrant the overhead of command dispatch.

Ports

Port Purpose
AccentColorPortInterface Get and update the authenticated user's accent color
SidebarConfigPortInterface Get and update the authenticated user's sidebar configuration

API Endpoints

All endpoints live under the /api/preferences prefix.

Method Path Purpose
GET /api/preferences/accent-color Get the authenticated user's accent color
PATCH /api/preferences/accent-color Update the authenticated user's accent color
GET /api/preferences/sidebar Get the authenticated user's sidebar configuration
PATCH /api/preferences/sidebar Update the authenticated user's sidebar configuration

All endpoints are scoped to the authenticated user. There are no admin or cross-user endpoints.

Cross-Context Relationships

Direction Context Details
Depends on Shared Uuid
Depends on Auth User identification (current user from security context)
Depended on by No contexts depend on UserPreference

Infrastructure

Component Type Purpose
AccentColorEntity Doctrine entity ORM entity for accent color storage
SidebarConfigEntity Doctrine entity ORM entity for sidebar configuration storage
AccentColorRepository Doctrine repository Implements AccentColorPortInterface
SidebarConfigRepository Doctrine repository Implements SidebarConfigPortInterface