feat(contacts): finish PMS-17 story (portal flag, drop dead alias) #22

Closed
David wants to merge 0 commits from feat/contacts-story-pms-17 into main
Owner

Implements YouTrack story PMS-17 (contacts / companies / sites). One commit per sub-task.

Sub-tasks

  • PMS-18 (F4) fix update_site silent no-op: already shipped in the audit-batch series; closed administratively.
  • PMS-19 honor create_portal_access on create_contact: flips contacts.is_portal_user = TRUE when set. The customer-side "pick a password" step belongs to the portal-session flow (PMS-26), so no portal_password_hash is minted here; the agent shares the portal URL out-of-band.
  • PMS-20 remove the dead /companies alias: .nest("/companies", Router::new()) matched nothing and made /api/v1/companies look mysteriously 404. Removed; canonical path is /api/v1/contacts/companies/... (documented inline).

Behaviour-visible changes

  • POST /api/v1/contacts/contacts with create_portal_access: true now flips the contact's is_portal_user flag (visible on subsequent GETs).
  • GET /api/v1/companies no longer matches; the canonical endpoint is /api/v1/contacts/companies.

Test plan

  • cargo check --bin mokosh-server clean (verified locally).
  • Smoke: POST /api/v1/contacts/contacts {"create_portal_access": true, ...} -> subsequent GET /api/v1/contacts/contacts/:id shows "is_portal_user": true.
  • Smoke: curl /api/v1/companies returns the global 404 (or fallback HTML, depending on host header), not a /companies 404.

Closes #PMS-17

Implements YouTrack story PMS-17 (contacts / companies / sites). One commit per sub-task. ## Sub-tasks - PMS-18 (F4) fix `update_site` silent no-op: already shipped in the audit-batch series; closed administratively. - PMS-19 honor `create_portal_access` on `create_contact`: flips `contacts.is_portal_user = TRUE` when set. The customer-side "pick a password" step belongs to the portal-session flow (PMS-26), so no `portal_password_hash` is minted here; the agent shares the portal URL out-of-band. - PMS-20 remove the dead `/companies` alias: `.nest("/companies", Router::new())` matched nothing and made `/api/v1/companies` look mysteriously 404. Removed; canonical path is `/api/v1/contacts/companies/...` (documented inline). ## Behaviour-visible changes - `POST /api/v1/contacts/contacts` with `create_portal_access: true` now flips the contact's `is_portal_user` flag (visible on subsequent GETs). - `GET /api/v1/companies` no longer matches; the canonical endpoint is `/api/v1/contacts/companies`. ## Test plan - [ ] `cargo check --bin mokosh-server` clean (verified locally). - [ ] Smoke: `POST /api/v1/contacts/contacts {"create_portal_access": true, ...}` -> subsequent `GET /api/v1/contacts/contacts/:id` shows `"is_portal_user": true`. - [ ] Smoke: `curl /api/v1/companies` returns the global 404 (or fallback HTML, depending on host header), not a `/companies` 404. Closes #PMS-17
When `create_contact` is called with `create_portal_access = true`, flip `contacts.is_portal_user = TRUE` so the portal-login flow that lands in PMS-26 can treat it as a valid identity. The password set step is deliberately left to the customer (handled by the portal-session work), so this commit does not mint a `portal_password_hash` here; the agent who created the contact will share the portal URL out-of-band and the customer picks a password during first login.

#PMS-19 State Done
chore(router): drop the dead /companies alias
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
2b634ab19f
`.nest("/companies", Router::new())` matched nothing, so `/api/v1/companies` returned a misleading 404 instead of either succeeding as an alias or returning a route-not-found from the parent. The canonical company endpoints already live under `/api/v1/contacts/companies/...`; clients pointing at the old path need to update.

#PMS-20 State Done
vas2000-work closed this pull request 2026-05-21 02:42:54 +02:00
Some checks are pending
Create release / Create release from merged PR (pull_request) Has been skipped
Check / * (pull_request)
Required
E2E / * (pull_request)
Required

Pull request closed

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-server!22
No description provided.