fix(crm): point CRM client paths at /contacts/companies and /contacts/contacts #53

Merged
YousifShkara merged 1 commit from feat/crm-ops into main 2026-06-04 07:18:47 +02:00
Owner

The mokosh-server router nests the companies + contacts + sites
sub-routes under /api/v1/contacts (one router for all three), so the
canonical paths are /api/v1/contacts/companies, /api/v1/contacts/contacts,
/api/v1/contacts/sites. The mokosh-apps client (this file and the
previous version it replaced) called /api/v1/companies and
/api/v1/contacts directly. Those routes do not exist - the comment
in src/api/router.rs in mokosh-server explicitly removed a dead
nest("/companies", ...) and points at /contacts/companies as the
canonical location.

Before this fix, the previous Demo-fallback code path was masking
the failure: GET /api/v1/companies returned 404, the page fell back
to the seeded Acme Corp / TechStart / Global Widgets rows, and the
user saw what looked like real data. Dropping the demo fallback in
the previous commit surfaced the wrong-path issue as 'Could not
load companies' on every list page and 405 on every POST (axum
returns 405 instead of 404 for a path that matches a parent route
prefix but no method).

Update every CRM call site:

  • /companies -> /contacts/companies
  • /companies/{id} -> /contacts/companies/{id}
  • /companies/{id}/contacts -> /contacts/companies/{id}/contacts
  • /companies/{id}/sites -> /contacts/companies/{id}/sites
  • /contacts -> /contacts/contacts
  • /contacts/{id} -> /contacts/contacts/{id}

Covers both list pages, both detail pages, both forms (new + edit),
the CompanyPicker search, the portal-access toggle, and every delete
button. Ticket-side paths (/tickets?company_id, /tickets?contact_id)
are unchanged - those routes nest under /tickets, not /contacts.

The mokosh-server router nests the companies + contacts + sites sub-routes under /api/v1/contacts (one router for all three), so the canonical paths are /api/v1/contacts/companies, /api/v1/contacts/contacts, /api/v1/contacts/sites. The mokosh-apps client (this file and the previous version it replaced) called /api/v1/companies and /api/v1/contacts directly. Those routes do not exist - the comment in src/api/router.rs in mokosh-server explicitly removed a dead nest("/companies", ...) and points at /contacts/companies as the canonical location. Before this fix, the previous Demo-fallback code path was masking the failure: GET /api/v1/companies returned 404, the page fell back to the seeded Acme Corp / TechStart / Global Widgets rows, and the user saw what looked like real data. Dropping the demo fallback in the previous commit surfaced the wrong-path issue as 'Could not load companies' on every list page and 405 on every POST (axum returns 405 instead of 404 for a path that matches a parent route prefix but no method). Update every CRM call site: - /companies -> /contacts/companies - /companies/{id} -> /contacts/companies/{id} - /companies/{id}/contacts -> /contacts/companies/{id}/contacts - /companies/{id}/sites -> /contacts/companies/{id}/sites - /contacts -> /contacts/contacts - /contacts/{id} -> /contacts/contacts/{id} Covers both list pages, both detail pages, both forms (new + edit), the CompanyPicker search, the portal-access toggle, and every delete button. Ticket-side paths (/tickets?company_id, /tickets?contact_id) are unchanged - those routes nest under /tickets, not /contacts.
fix(crm): point CRM client paths at /contacts/companies and /contacts/contacts
Some checks failed
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Failing after 9s
e9e2ae6014
The mokosh-server router nests the companies + contacts + sites
sub-routes under /api/v1/contacts (one router for all three), so the
canonical paths are /api/v1/contacts/companies, /api/v1/contacts/contacts,
/api/v1/contacts/sites. The mokosh-apps client (this file and the
previous version it replaced) called /api/v1/companies and
/api/v1/contacts directly. Those routes do not exist - the comment
in src/api/router.rs in mokosh-server explicitly removed a dead
nest("/companies", ...) and points at /contacts/companies as the
canonical location.

Before this fix, the previous Demo-fallback code path was masking
the failure: GET /api/v1/companies returned 404, the page fell back
to the seeded Acme Corp / TechStart / Global Widgets rows, and the
user saw what looked like real data. Dropping the demo fallback in
the previous commit surfaced the wrong-path issue as 'Could not
load companies' on every list page and 405 on every POST (axum
returns 405 instead of 404 for a path that matches a parent route
prefix but no method).

Update every CRM call site:
- /companies              -> /contacts/companies
- /companies/{id}         -> /contacts/companies/{id}
- /companies/{id}/contacts -> /contacts/companies/{id}/contacts
- /companies/{id}/sites   -> /contacts/companies/{id}/sites
- /contacts               -> /contacts/contacts
- /contacts/{id}          -> /contacts/contacts/{id}

Covers both list pages, both detail pages, both forms (new + edit),
the CompanyPicker search, the portal-access toggle, and every delete
button. Ticket-side paths (/tickets?company_id, /tickets?contact_id)
are unchanged - those routes nest under /tickets, not /contacts.
YousifShkara deleted branch feat/crm-ops 2026-06-04 07:18:47 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!53
No description provided.