fix(calendar): create/update/delete via /appointments, role-gate users fetch #66
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!66
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/calendar-appointment-crud-paths-and-role-gate-users-fetch"
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?
After PR #65 fixed the GET range and users path, two more errors surfaced on the calendar page.
POST /api/v1/calendar/appointmentsreturned 405. The mokosh-server route table only registers GET on/calendar/appointments(the range alias), with create/update/delete intentionally living on/appointmentsinstead (src/modules/calendar/routes.rs:36-51comment: "Read-only - mutations stay on/appointments"). The SPA was POSTing/PUTting/DELETing to/calendar/appointments[/{id}]. Switch all three mutation paths to/appointments[/{id}]to match the server's API split.GET /api/v1/auth/users?per_page=100returned 403 for non-admin sessions. The endpoint is gated to Admin / Manager (src/modules/auth/routes.rs::list_users); Bunyip-OIDC users are JIT-provisioned as Technicians (modules/auth/middleware.rs:459,UserRole::default()), so they cannot list users. The SPA already swallowed the error viaunwrap_or_default(), but the browser logged it on every page load. Guard the fetch withuser.role.can_manage_users()so technicians skip the call entirely; the assignee dropdown stays empty and the user can only self-assign, which is what their role allows server-side anyway.