---
module: profile.display
title: Display
tab: Architect
order: 30
audience: dev
---

How **Profile → Display** is built. Two moving parts: a thin Svelte view in `hiveops-profile` and a preferences store owned entirely by `hiveops-auth`. There is **no Kafka, no executor/record-store pipeline, and no dedicated table** for this feature — it is a synchronous read/write of a JSONB blob.

## Services involved
- **hiveops-profile (frontend only)** — `profile.bcos.cloud`. Svelte SPA. Component: `frontend/src/components/Profile/DisplaySettings.svelte`. It calls `profileAPI` in `frontend/src/lib/api.ts`, which points an axios client at the gateway (`window.__APP_CONFIG__.apiUrl`, fallback `localhost:8080`).
- **hiveops-auth (backend + data owner)** — port **8082**, DB **`hiveiq_auth`**. Owns the user record and the preferences blob. No other service writes Display prefs. See [platform.service-ownership].

## Data flow (write)
```
DisplaySettings.svelte (Save)
  └─ profileAPI.updatePreferences({itemsPerPage,dateFormat,timeFormat,timezone})
       └─ PUT {gateway}/auth/api/users/me/preferences   (Bearer JWT)
            └─ UserProfileController.updatePreferences(@AuthenticationPrincipal)
                 └─ UserProfileService.updatePreferences(email, req)   [@Transactional]
                      • load User by email
                      • copy only non-null request fields onto UserPreferences
                      • userRepository.save(user)  ──► UPDATE users SET preferences = <jsonb>
```
Read path is the mirror: `GET /auth/api/users/me/preferences` → `UserProfileService.getPreferences(email)` → returns the user's `UserPreferences` (or a fresh defaults object if the column is null).

**Partial-update semantics:** `updatePreferences` applies a field only when the request value is non-null. The Display view sends only its four fields, so notification/appearance/security prefs in the same blob are preserved untouched. This is a deliberate merge, not a full replace.

## DB tables read/written
- **`users`** (`hiveiq_auth`) — single table. Column `preferences JSONB NOT NULL DEFAULT '{}'` added by Flyway `V9__add_user_preferences.sql`.
- Mapped on the entity via Hibernate `@JdbcTypeCode(SqlTypes.JSON)` + `@Column(columnDefinition = "jsonb")` on `User.preferences` (type `UserPreferences`, a plain `@Data` POJO — **not** a separate `@Entity`, so no join, no child table).
- No other tables. No `device_summary`-style mirror. See [platform.data-architecture].

## Kafka
- **None for this feature.** Display preferences produce/consume no topics. (Contrast with device or messaging data.) See [platform.kafka] for where the platform does use eventing — Display simply isn't one of those paths.

## Key API endpoints (owned by hiveops-auth)
| Method | Path | Purpose |
|--------|------|---------|
| GET | `/auth/api/users/me/preferences` | Fetch current user's full prefs blob (incl. Display) |
| PUT | `/auth/api/users/me/preferences` | Merge-update prefs; returns saved `UserPreferences` |

Both resolve the target user from the JWT (`@AuthenticationPrincipal UserDetails` → email), never from a path variable — one user can only ever touch their own row.

## Model (Display subset of `UserPreferences`)
| Field | Type | Default | Validation |
|-------|------|---------|-----------|
| `itemsPerPage` | int | 25 | `@Min(1) @Max(500)` on request DTO |
| `dateFormat` | String | `MM/DD/YYYY` | none server-side |
| `timeFormat` | String | `12-hour` | none server-side (UI: `12-hour`/`24-hour`) |
| `timezone` | String | `America/New_York` | none server-side |

## Consumption
Display prefs are **applied client-side by each SPA**, not enforced by a gateway or shared filter. Any app that wants to honor a user's page size / date format calls `GET /auth/api/users/me/preferences` and formats locally. hiveops-auth is the single source of truth; rendering is distributed.

## Cross-links
- [platform.data-architecture] — JSONB-on-entity storage vs dedicated tables
- [platform.kafka] — eventing overview (Display uses none)
- [platform.service-ownership] — auth owns identity + user preferences
