feat(ui): 3-tab UI per spec — admin dashboard + date filter, personal dashboard, training w/ difficulty, settings profile
Tab 1 Admin overview (/): aggregate stats + DATE FILTER (?from&to), hardest personas, admin quick actions (Users / + Add product). Tab 2 My dashboard (/my/board): per-user win/lose/session summary (works for admin too). Tab 3 Training (/training): product list w/ status + persona count; admins see all groups (draft->analyze/edit), trainees see ready->personas; persona list shows DIFFICULTY (1-5 stars); admins get a Manage-personas button. Settings (/settings): profile (name/email) via new PATCH /api/auth/profile + change password + language. Backend: analytics date filter; profile endpoint; /api/me/board + /api/chat/sessions opened to any authed user. Rebuilt frontend/dist.
This commit is contained in:
@@ -65,3 +65,20 @@ def setup():
|
||||
"user": _store().public_user(updated),
|
||||
"must_setup": False,
|
||||
})
|
||||
|
||||
|
||||
@auth_bp.patch("/profile")
|
||||
@require_auth
|
||||
def profile():
|
||||
"""Self-service profile update: name (and optional email). Any authenticated user."""
|
||||
user = current_user()
|
||||
data = request.get_json(silent=True) or {}
|
||||
username = user.get("username") or user.get("id")
|
||||
try:
|
||||
if "name" in data:
|
||||
_store().set_name(username, data.get("name"))
|
||||
if "email" in data:
|
||||
_store().set_email(username, data.get("email"))
|
||||
except AuthError as exc:
|
||||
raise ApiError(str(exc), 400)
|
||||
return jsonify({"user": _store().public_user(_store().get_user(username))})
|
||||
|
||||
Reference in New Issue
Block a user