feat(orgs): org request endpoints — submit + mine (task 1.2, ORG-01/04/06) #54
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!54
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/1.2-org-requests"
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?
Phase 1 task 1.2: the founder journey's entry point, riding on task 1.1's Pending state.
New:
Features/OrgRequests/on/api/org-requestsTenantRequest(Pending)and flips the user NoWorkspace → Pending (state machine §4.2; ExecuteUpdate per #44). Audited.Rejected requesters can re-submit (ORG-03 premise — test-covered). The legacy
/api/tenant-requestsadmin queue is unchanged (same entity).Tests (TDD §2.1)
OrgRequestTests(7) written first — red at 6 (routes absent), green after. Two review notes from red: #17 had been closed prematurely (reopened); the middleware allowlist from 1.1 already carried the route.Verification
761/761 ×2 (Release); pre-push hook green, coverage 83.53% ≥ 80.
Closes #17 (task 1.2). Next: task 1.3 — approval rework (ORG-02/03).
ponytail-review (§2.4 AI first-pass) — Verdict: Ship.
What this change does: adds the org-request submit/poll endpoints on the repurposed TenantRequest entity, gates submissions to no-org users with an email, enforces one-pending-request (409), and flips the submitting user to UserStatus.Pending.
Checked: route group sits inside the 1.1 middleware allowlist (pending + no-workspace founders can reach it; workspace holders too — but the handler 403s them, defense in depth); ExecuteUpdate for the status flip (AsNoTracking #44); email guard closes the baseline-review silent-failure path (RequesterEmail == ""); length caps on name/reason (DB has no max on those columns — bounded before insert); audit action kept as tenant.requested for admin-queue compatibility; /mine is AsNoTracking + most-recent-first.
Notes (not blocking): slug collision handling lives in the approval path (task 1.3, existing -2/-3 logic); no pagination needed on /mine (single row by construction); legacy /api/tenant-requests submit route still exists in parallel — removed at decommission per MIG-04.