unit(B1): invite -> pending -> approve/deny with console outbox

Admin-invite lifecycle (BUILD-PLAN Phase B, depends A3):
- src/auth/invites.ts: pure nextUserStatus() rule (invite->pending_approval,
  approve->active, deny->denied) + isSignInEligible() mirroring the Auth.js
  authorize guard; thin DB wrappers inviteUser/approveUser/denyUser;
  enqueueOutbox() console transport (launch, ARCHITECTURE 3.4).
- Routes: /api/dev/invite, /api/dev/approve, /api/dev/deny.
- src/auth/invites.test.ts: 7 tests named after the rules.
- magic-link.ts exports APP_ORIGIN.
No migration: users.status already carries the enum (A2).
Verify: typecheck, lint, 24 unit tests (+7), build, 4 e2e all green; runtime
smoke test confirms invite->pending, approve->active signs in, deny->denied
gets no session.
This commit is contained in:
Tiel Coder
2026-11-17 23:46:07 +00:00
parent 3451bced82
commit 5f0b94af6a
7 changed files with 418 additions and 1 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ const SECRET = new TextEncoder().encode(
export const AUTO_ACTIVATE_NEW_USERS =
process.env.AUTO_ACTIVATE_NEW_USERS !== "false";
const APP_ORIGIN =
export const APP_ORIGIN =
process.env.AUTH_URL ??
process.env.NEXTAUTH_URL ??
process.env.APP_ORIGIN ??