"""Legacy beta signup endpoint — redirects to /register?from=beta. Phase 2 (self-serve signup) makes the public register flow the canonical front door. The old `/api/v1/beta-signup` POST endpoint is kept mounted to preserve any external links that still hit it, but now responds with a 307 Temporary Redirect to `/register?from=beta` so the user lands in the real signup flow. The `?from=beta` marker lets the frontend tag the signup origin for analytics. Note: there is no `beta_signup` database table — the original endpoint only fired a notification email. There is therefore no waitlist to email and no migration to run when retiring the endpoint. """ import logging from fastapi import APIRouter from fastapi.responses import RedirectResponse from app.core.config import settings logger = logging.getLogger(__name__) router = APIRouter(prefix="/beta-signup", tags=["beta"]) # Local-dev fallback when FRONTEND_URL isn't configured. The redirect must # be absolute — a relative URL would resolve against the API origin # (api.resolutionflow.com), which has no /register page. _DEFAULT_FRONTEND_URL = "http://localhost:5173" @router.post("", include_in_schema=False) async def beta_signup_redirect() -> RedirectResponse: """Redirect legacy beta-signup POST to the public register page. Returns 307 so any client following the redirect preserves the HTTP method; the frontend treats `/register?from=beta` as the canonical entry point and reads the `from` query param for analytics. """ frontend_url = settings.FRONTEND_URL or _DEFAULT_FRONTEND_URL return RedirectResponse( url=f"{frontend_url}/register?from=beta", status_code=307, )