feat(orgs): tour agent organization registration, slice A (#37) #107
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/kws!107
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/37-org-registration"
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?
Slice A of #37: tour agent company (organization) registration for the partner portal. Does not close #37 (invitations and organization accounts are slice B; the plan outlines it).
What it does
POST /v1/me/organizations(Idempotency-Keyrequired; one open registration per user; the Kenya Wildlife Service type is staff-only). They upload documents as raw PDF/JPEG/PNG bodies (type sniffed and matched toContent-Type, 5 MiB, 20 per company, append-only, bytes in PostgreSQL behindorgs.DocumentStoreuntil #18 adds object storage).pending -> reviewed -> verified -> active(orrejected, final), and can disable and re-enable:POST /v1/admin/organizations/{id}/status. The status machine is enforced by a DB guard; every change writes an append-only log row; remarks are shown to the applicant.admin_portal.organizations.view|review|verify|approve), all platform scope only, assigned to the legacy role groups; an organization's own admins can never approve themselves.partner_portal_urlsetting (https only).rbac.PlatformOnly/PlatformHashelper (payments now uses it too, behaviour unchanged).Owner decisions (approved defaults)
Verified-login registration (legacy was anonymous); three review steps by legacy role group; rejected is final; registrant (not the form's contact email) becomes the first administrator; disable cuts access only; no virus scan before public launch; 5 MiB / 20 files / PDF only; no new KRA/registration fields; legacy "Pending hard-copy" and "Approved" statuses dropped.
Known limits (ADR 0021)
No virus scan (ClamAV job is the upgrade); document bytes in PostgreSQL until #18; no invitations or member management (slice B); any verified user can make KWS email an address they type, once per open registration (rate limits #62); no four-eyes rule; after
rejectedthe guard protects only status and registrant; a same-status move answers 200 without the step check; uploads are held in memory (up to 5 MiB per request).Review (dual pass)
.exe, or a PDF/HTML polyglot saved as.html). Downloads now use the stored type's extension and file names drop format characters. Minor items fixed or documented in the ADR.Verification
go test -race -count=1 ./...green,make lint0 issues,make contractok, TypeScript and Dart clients generate,make cover: total coverage 90.8% (minimum 80%).Note for bisecting: commits
5ff67d4andb8a11cdfailTestSpec_AndTheRoutesInTheCodeAreTheSameSet(the contract test scans the source for routes, and the spec arrives in the last task). The branch head is green.Deploy
Run migration 0025 (
KWS_MODE=migrate). Set thepartner_portal_urlsetting (https URL) for the approved email link. SMTP must be configured on API and worker for the emails (as for purchases). The worker must be running.🤖 Generated with Claude Code