CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

feat(email): Google Workspace domain import (Phase 1) + Business pricing #4071

Merged⚡ AI-generatedXSccantynz wants to mergeclaude/google-oauth-setup-UYn0Rmainopened Jun 11, 2026
ccantynzcommented Jun 11, 2026

Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/60


What

Google Workspace domain-wide import (Phase 1) — the "switch your whole company onto AlecRae" flow — plus the Craig-approved Business pricing recorded in the Bible.

Workspace import

  • lib/google-workspace.ts — Admin SDK Directory client: admin OAuth (Directory read + gmail.readonly), code exchange, paginated users.list.
  • routes/workspace-import.ts (mounted at /v1/import/workspace):
    • GET /start — admin authorizes (Directory scope)
    • GET /callback — stores the admin grant in connected_accounts (status='workspace_admin', sync_cursor=domain)
    • GET /users — lists the domain's Workspace users
    • POST /provisionbulk-creates native mailboxes from selected users on a verified domain (reuses the mailboxes table from #59)
  • No schema change — the admin-grant marker reuses connected_accounts, so the drift guard stays green.

Verification

  • POST /provision over HTTP against a fresh DB: created 2 mailboxes, skipped the off-domain address, HTTP 200, and idempotent on re-run (created 0). ✅
  • apps/api typecheck clean ✅
  • The Directory-enumeration endpoints (/start /callback /users) are typechecked + written to the Admin SDK spec; they need live admin creds to verify (can't exercise Google from CI). Phase 2 = per-user mail migration via the existing /v1/import pipeline.

Pricing

Records the approved multi-currency Business / Business Plus tiers in CLAUDE.md (NZ$25/$45 incl GST, US$16/$30, etc.). Billing wiring (currency-aware price-per-tier-per-currency) is the next step.

Follow-ups

  • Token refresh for the stored admin grant (Phase 1 uses the access token; expiry → "reconnect").
  • Phase 2: bulk mail migration per provisioned mailbox.
  • Wire Stripe Business package + Stripe Tax.

https://claude.ai/code/session_01McgJLnTbZG9mwhfwd5iAX3


Generated by Claude Code

ccantynzcommented Jun 11, 2026

Originally written by @vercel[bot] on GitHub.


Deployment failed with the following error:

There is no GitHub account connected to this Vercel account.
ccantynzcommented Jun 11, 2026

Originally written by @vercel[bot] on GitHub.


The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
alec-rae-com-admin Ready Ready Preview, Comment Jun 11, 2026 9:45am

Cross-repo impact

See what breaks downstream if this PR merges.

Analyze →
⮌ Merged

This pull request was merged into main.

c comment · e edit title · m merge · a approve · r request changes · ? shortcuts