feat(supplier): the portal invites a supplier for one component (#1027) #1047

Merged
sharang merged 1 commits from feat/supplier-invites into main 2026-11-18 11:33:00 +00:00
Owner

Part of #1027 (supplier SBOM epic #1029, phase 3). This is the first of two API PRs. The upload through an invite follows.

What it adds

Platform endpoints that the portal calls with its service token (require_platform_token):

Call What it does
POST /api/v1/platform/tenants/{id}/supplier-invites {target_id, email, invited_by} Invites a supplier for one supplier component. Answers 201 with the invite.
GET /api/v1/platform/tenants/{id}/supplier-invites[?target=<id>] Lists the tenant's invites, newest first, each with its state.
POST /api/v1/platform/tenants/{id}/supplier-invites/{invite}/withdraw {withdrawn_by} Withdraws an invite. A second withdrawal keeps the first.
  • Where invites are kept: in the tenant database, collection supplier_invites. The tenant export and erasure therefore cover it, including the supplier's e-mail address.
  • What Prüfwerk stores: the invite only. It never sees the link token: the portal owns the token and the mail, and keys the link by the invite id. These were the user's decisions of 2026-11-18, recorded on #1027.
  • Lifetime: 90 days. The state is active, expired or withdrawn; a withdrawn invite stays withdrawn after it expires.
  • Which targets can be invited for: only a supplier component, meaning a target with supplier. Any other target answers 422, and an unknown target or tenant 404. A lookup in an unknown tenant creates no database.
  • Target deletion: deleting a target deletes its invites.
  • Portal target list: GET /api/v1/platform/tenants/{id}/targets now names each supplier component's supplier, so the invite dialog can offer them.
  • Docs: docs/guide/sbom.md.

Mockup of the portal pages (awaiting approval): https://claude.ai/artifact/FKKpDUkTgY1rezxwJwjXDT

Tests

  • Unit tests for the lifetime, the states, and address and actor validation.
  • Mongo integration tests in tests/supplier_invites.rs: invite only for a supplier component; refusals; no database for an unknown tenant; supplier in the target list; list order and states; withdraw once; another tenant's invite not found.
  • The cascade test checks that a deleted target's invites go and other targets' invites stay.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Part of #1027 (supplier SBOM epic #1029, phase 3). This is the first of two API PRs. The upload through an invite follows. ## What it adds Platform endpoints that the portal calls with its service token (`require_platform_token`): | Call | What it does | |---|---| | `POST /api/v1/platform/tenants/{id}/supplier-invites` `{target_id, email, invited_by}` | Invites a supplier for one supplier component. Answers `201` with the invite. | | `GET /api/v1/platform/tenants/{id}/supplier-invites[?target=<id>]` | Lists the tenant's invites, newest first, each with its `state`. | | `POST /api/v1/platform/tenants/{id}/supplier-invites/{invite}/withdraw` `{withdrawn_by}` | Withdraws an invite. A second withdrawal keeps the first. | - **Where invites are kept:** in the tenant database, collection `supplier_invites`. The tenant export and erasure therefore cover it, including the supplier's e-mail address. - **What Prüfwerk stores:** the invite only. It never sees the link token: the portal owns the token and the mail, and keys the link by the invite `id`. These were the user's decisions of 2026-11-18, recorded on #1027. - **Lifetime:** 90 days. The state is `active`, `expired` or `withdrawn`; a withdrawn invite stays withdrawn after it expires. - **Which targets can be invited for:** only a supplier component, meaning a target with `supplier`. Any other target answers `422`, and an unknown target or tenant `404`. A lookup in an unknown tenant creates no database. - **Target deletion:** deleting a target deletes its invites. - **Portal target list:** `GET /api/v1/platform/tenants/{id}/targets` now names each supplier component's `supplier`, so the invite dialog can offer them. - **Docs:** `docs/guide/sbom.md`. Mockup of the portal pages (awaiting approval): https://claude.ai/artifact/FKKpDUkTgY1rezxwJwjXDT ## Tests - Unit tests for the lifetime, the states, and address and actor validation. - Mongo integration tests in `tests/supplier_invites.rs`: invite only for a supplier component; refusals; no database for an unknown tenant; `supplier` in the target list; list order and states; withdraw once; another tenant's invite not found. - The cascade test checks that a deleted target's invites go and other targets' invites stay. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-18 10:36:10 +00:00
feat(supplier): the portal invites a supplier for one component (#1027)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m16s
CI / Check (pull_request) Successful in 22m0s
5ec891fa28
Phase 3 of the supplier SBOM epic: the platform API the portal calls with its
service token to invite a supplier, list the tenant's invites and withdraw one.

- An invite is kept in the tenant's own database (`supplier_invites`), so the
  tenant export and erasure cover it, the supplier's address included. The
  portal owns the secret link and the mail and keys its link by the invite id.
- Only a supplier component (a target with `supplier`) can be invited for;
  any other answers 422, an unknown target or tenant 404, and a lookup in an
  unknown tenant creates no database.
- An invite is valid for 90 days and its state is `active`, `expired` or
  `withdrawn`; a second withdrawal keeps the first.
- Deleting a target deletes its invites.
- The portal's target list names each supplier component's `supplier`.

The upload through an invite follows in its own PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit dc14c77e84 into main 2026-11-18 11:33:00 +00:00
sharang deleted branch feat/supplier-invites 2026-11-18 11:33:00 +00:00
Sign in to join this conversation.