feat(5.2): add User Preferences API with full-stack implementation
Backend: - Create app/models/user_preference.py with TenantMixin (user_id, key, value JSONB) - Create app/routes/user_preferences.py with GET/PUT/DELETE endpoints + RBAC - Add user_preferences:read/write to CORE_PERMISSIONS - Add user_preferences to legacy role permissions (admin/editor/viewer) - Register route in app/main.py and app/routes/__init__.py - Create alembic migration 0028_user_preferences - Add UserPreference model to conftest.py for test schema - Fix pre-existing conftest seed (Contact industry field removed in migration 0027) Frontend: - Create frontend/src/api/userPreferences.ts with React Query hooks - Create frontend/src/hooks/useUserPreferences.ts syncing with uiStore - Add i18n entries for de.json and en.json Tests: - 13 tests covering CRUD, tenant isolation, CSRF, unauthenticated access - All tests passing
This commit is contained in:
@@ -41,6 +41,8 @@ CORE_PERMISSIONS: list[dict[str, str]] = [
|
||||
{"key": "attachments:delete", "label": "Attachments: Delete", "category": "core", "module": "attachments"},
|
||||
{"key": "workflows:read", "label": "Workflows: Read", "category": "core", "module": "workflows"},
|
||||
{"key": "workflows:write", "label": "Workflows: Write", "category": "core", "module": "workflows"},
|
||||
{"key": "user_preferences:read", "label": "User Preferences: Read", "category": "core", "module": "user_preferences"},
|
||||
{"key": "user_preferences:write", "label": "User Preferences: Write", "category": "core", "module": "user_preferences"},
|
||||
{"key": "sequences:read", "label": "Sequences: Read", "category": "core", "module": "sequences"},
|
||||
{"key": "sequences:write", "label": "Sequences: Write", "category": "core", "module": "sequences"},
|
||||
{"key": "addresses:read", "label": "Addresses: Read", "category": "core", "module": "addresses"},
|
||||
|
||||
Reference in New Issue
Block a user