feat(auth): persist per-user theme preference (base mode + accent) (PMS-410) #301
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-410-theme-prefs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements PMS-410: a per-user theme preference (theme_base_mode + theme_accent_id) that backs the MAPPS-259 theme picker's cross-device sync.
Mirrors the existing date_format_string field at every touchpoint: migration 054_user_theme_prefs.sql (nullable TEXT + CHECK), the UserRow row struct and its From mapping, the User / CurrentUser / UserResponse / UpdateUserRequest / CreateUserRequest DTOs, and the auth service SELECT / INSERT / UPDATE paths plus the at_jwt construction. Adds a validate_theme_base_mode custom validator so an invalid base mode returns a clean 422 (a bare DB CHECK violation maps to 500, so the CHECK stays as defense-in-depth).
GET /api/v1/auth/me returns both fields; PUT accepts and persists them (omitted fields unchanged); unset defaults to NULL.
Verified in the dev container: cargo check --all-targets, the tests/auth.rs round-trip integration test (persist, read-back, partial update, invalid base mode -> 422), migration 054 applies cleanly, cargo fmt --check, clippy -D warnings, and the pre-commit hook.
Merge this before the mokosh-apps MAPPS-259 account-sync relies on these fields in a deployed environment.
#PMS-410