fix(crm): point CRM client paths at /contacts/companies and /contacts/contacts #53
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
psa-systems/mokosh-apps!53
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/crm-ops"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
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.