Skip to content

Add V2 user API with REST semantics + edit user feature - #1159

Merged
Tim020 merged 4 commits into
devfrom
feature/user-api-v2-edit-user
Jun 7, 2026
Merged

Add V2 user API with REST semantics + edit user feature#1159
Tim020 merged 4 commits into
devfrom
feature/user-api-v2-edit-user

Conversation

@Tim020

@Tim020 Tim020 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Explicit API versioning: all existing V1 controllers moved from controllers/api/ into controllers/api/v1/ (same package hierarchy, no behaviour change); test package mirrors the same structure under test/controllers/api/v1/
  • V2 user management API: new RESTful endpoints under controllers/api/v2/users/ that fix the non-REST verb problems in V1 (POST /auth/createPOST /api/v2/users, POST /auth/deleteDELETE /api/v2/users?id=); adds new PATCH /api/v2/users?id= for user editing; PATCH /api/v2/users/password, POST /api/v2/users/password/reset, and GET/POST/DELETE /api/v2/users/token also migrated to the correct resource namespace
  • Auth session endpoints stay V1: login, logout, refresh-token, and get-current-user were already RESTful — only the V2 user management routes are new; auth remains at /api/v1/auth/*
  • Edit user feature: admins can toggle a user's admin status from the Users tab in System Config; extensible by design — adding a new editable field requires one word in EDITABLE_FIELDS on the backend and one <BFormGroup> in each modal
  • Both frontends updated: Vue 2 (client/) and Vue 3 (client-v3/) store actions and components updated for V2 user endpoints; Edit button and modal added to ConfigUsers.vue in both clients
  • 17 new backend tests for the V2 user controller; 3 new Playwright E2E tests covering promote, demote, and self-edit-disabled flows
  • Documentation updated in docs/pages/user_config.md

Test plan

  • Backend: pytest test/ — 651/651 pass
  • Backend formatting: ruff check + ruff format --check — clean
  • Vue 2: npm run ci-lint + npm run typecheck + npm run test:run — 128/128 pass
  • Vue 3: npm run ci-lint + npm run typecheck + npm run test:run — 23/23 pass
  • E2E (Chromium): npm run test:e2e — 163/163 pass (1 pre-existing flaky on live-show scroll-sync, unrelated to this change, passed on retry)

🤖 Generated with Claude Code

Tim020 and others added 3 commits June 7, 2026 11:48
Introduces a versioned V2 API layer for user management, moving all existing
controllers into an explicit `api/v1/` package and adding `api/v2/` with RESTful
resource-oriented endpoints (GET/POST/PATCH/DELETE on `/api/v2/users`). Adds a new
edit-user feature allowing admins to toggle user admin status, wired into both the
Vue 2 and Vue 3 frontends with an extensible modal design (adding a new editable
field requires only one line in EDITABLE_FIELDS and one form group in the template).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves all V1 controller tests from test/controllers/api/ into
test/controllers/api/v1/ (with auth/ subpackage), mirroring the
structure introduced when V1 controllers moved to controllers/api/v1/.
The existing test/controllers/api/v2/ tests remain in place.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The V1 auth endpoints (login, logout, refresh-token, get current user)
already used correct HTTP verbs and needed no refactoring. The V2 duplicates
added no value and only increased maintenance burden. V2 remains exclusively
for user management endpoints where V1 violated REST conventions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tim020 Tim020 added the claude Issues created by Claude label Jun 7, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation client Pull requests changing front end code large-diff server Pull requests changing back end code client-v3 labels Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Client V3 Test Results

23 tests  ±0   23 ✅ ±0   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit ce59b2b. ± Comparison against base commit bbe7180.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Client Test Results

128 tests  ±0   128 ✅ ±0   0s ⏱️ ±0s
  6 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit ce59b2b. ± Comparison against base commit bbe7180.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Python Test Results

  1 files  ± 0    1 suites  ±0   1m 56s ⏱️ +20s
651 tests +17  651 ✅ +17  0 💤 ±0  0 ❌ ±0 
656 runs  +17  656 ✅ +17  0 💤 ±0  0 ❌ ±0 

Results for commit ce59b2b. ± Comparison against base commit bbe7180.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Playwright E2E Results (chromium)

163 tests  +3   163 ✅ +3   1m 37s ⏱️ -1s
 14 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit ce59b2b. ± Comparison against base commit bbe7180.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Playwright E2E Results (firefox)

163 tests  +3   163 ✅ +3   1m 40s ⏱️ +3s
 14 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit ce59b2b. ± Comparison against base commit bbe7180.

♻️ This comment has been updated with latest results.

…ints

Password change and reset endpoints already used correct HTTP verbs in V1
(PATCH and POST respectively) and contained no logic changes in V2 — only
a URL namespace move. Keeping only the V2 token controller where the POST
/revoke → DELETE fix was a genuine REST improvement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
12.3% Duplication on New Code (required ≤ 3%)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@Tim020
Tim020 merged commit 7d79ca6 into dev Jun 7, 2026
34 of 35 checks passed
@Tim020
Tim020 deleted the feature/user-api-v2-edit-user branch June 7, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Issues created by Claude client Pull requests changing front end code client-v3 documentation Improvements or additions to documentation large-diff server Pull requests changing back end code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant