refactor(js): update internal /api/* calls to canonical domain routes#3557
refactor(js): update internal /api/* calls to canonical domain routes#3557ellitedom03 wants to merge 1 commit into
Conversation
Replace legacy /api/setting, /api/users, /api/projects URL references in JS controllers with their canonical domain-based equivalents: - /api/setting → /setting/logo - /api/users → /users/profileImage (POST upload) - /api/users?profileImage= → /users/profileImage/:id (GET src) - /api/projects → /projects/projectImage Affected files: - Setting/Js/settingRepository.js - Users/Js/usersRepository.js - Projects/Js/projectsController.js - Canvas/Js/canvasController.js - Goalcanvas/Js/goalCanvasController.js - Tickets/Js/ticketsController.js - Ideas/Js/ideasController.js The legacy /api/* routes remain as backward-compat aliases but should no longer be the primary call targets in first-party JS. Closes part of Leantime#2936
|
|
There was a problem hiding this comment.
Pull request overview
This PR refactors first-party JavaScript to call the canonical domain-scoped routes for logo/profile/project image uploads and for user profile image rendering, replacing legacy /api/* shim URLs (which are retained server-side for backward compatibility).
Changes:
- Update multipart upload endpoints:
- Company logo:
/api/setting→/setting/logo - User profile photo:
/api/users→/users/profileImage - Project avatar:
/api/projects→/projects/projectImage
- Company logo:
- Update user avatar
<img src>construction in JS controllers:/api/users?profileImage={id}→/users/profileImage/{id}
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/Domain/Users/Js/usersRepository.js | Updates user photo upload URL to /users/profileImage. |
| app/Domain/Tickets/Js/ticketsController.js | Updates avatar image src to /users/profileImage/{id} in two UI update paths. |
| app/Domain/Setting/Js/settingRepository.js | Updates logo upload URL to /setting/logo. |
| app/Domain/Projects/Js/projectsController.js | Updates project avatar upload URL to /projects/projectImage. |
| app/Domain/Ideas/Js/ideasController.js | Updates avatar image src to /users/profileImage/{id} after author change. |
| app/Domain/Goalcanvas/Js/goalCanvasController.js | Updates avatar image src to /users/profileImage/{id} after author change. |
| app/Domain/Canvas/Js/canvasController.js | Updates avatar image src to /users/profileImage/{id} after author change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| type: 'POST', | ||
| url: leantime.appUrl + '/api/users', | ||
| url: leantime.appUrl + '/users/profileImage', |
|
@marcelfolaron gentle ping on this — PR has been ready for review since June 20. Happy to address any feedback. This is linked to the Opire bounty on issue #2936. |
Summary
Closes part of #2936.
This PR updates all first-party JavaScript to use the canonical domain-scoped routes instead of the legacy
/api/*shims.Changes
/api/setting(POST)/setting/logoSetting/Js/settingRepository.js/api/users(POST upload)/users/profileImageUsers/Js/usersRepository.js/api/users?profileImage=(GET src)/users/profileImage/:idCanvas, Goalcanvas, Tickets, Ideas/api/projects(POST upload)/projects/projectImageProjects/Js/projectsController.jsNotes
/api/*aliases are kept inroutes.phpfor backward compatibility (plugins, external integrations)./api/*canvasand/api/blueprints/*are already going through properApi\Controllers\CanvasandApi\Controllers\Goalcanvas— no change needed there.multipart/form-datajQuery.ajax — they cannot use JSON-RPC due to the binary payload.Testing