Skip to content

refactor(js): update internal /api/* calls to canonical domain routes#3557

Open
ellitedom03 wants to merge 1 commit into
Leantime:masterfrom
ellitedom03:fix/update-internal-api-calls-to-canonical-routes
Open

refactor(js): update internal /api/* calls to canonical domain routes#3557
ellitedom03 wants to merge 1 commit into
Leantime:masterfrom
ellitedom03:fix/update-internal-api-calls-to-canonical-routes

Conversation

@ellitedom03

Copy link
Copy Markdown

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

Legacy URL Canonical URL File
/api/setting (POST) /setting/logo Setting/Js/settingRepository.js
/api/users (POST upload) /users/profileImage Users/Js/usersRepository.js
/api/users?profileImage= (GET src) /users/profileImage/:id Canvas, Goalcanvas, Tickets, Ideas
/api/projects (POST upload) /projects/projectImage Projects/Js/projectsController.js

Notes

  • The legacy /api/* aliases are kept in routes.php for backward compatibility (plugins, external integrations).
  • Canvas PATCH calls to /api/*canvas and /api/blueprints/* are already going through proper Api\Controllers\Canvas and Api\Controllers\Goalcanvas — no change needed there.
  • File upload calls remain as multipart/form-data jQuery.ajax — they cannot use JSON-RPC due to the binary payload.
  • All 7 files linted clean.

Testing

  • Logo upload in company settings
  • User profile photo upload
  • Project avatar upload
  • User avatar display in canvas, goals, tickets, ideas dropdowns

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
Copilot AI review requested due to automatic review settings June 20, 2026 17:45
@ellitedom03 ellitedom03 requested a review from a team as a code owner June 20, 2026 17:45
@ellitedom03 ellitedom03 requested review from marcelfolaron and removed request for a team June 20, 2026 17:45
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
  • 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',
@ellitedom03

Copy link
Copy Markdown
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants