fix(mail): explicit imports for MS-OAuth handlers (createOauthPendingState et al.)

Runtime-Error im /init und /callback weil Nitro auto-import nur server/utils/
scannt, nicht server/db/. Die Helper-Funktionen (createOauthPendingState,
consumeOauthPendingState, upsertOauthMicrosoftConnection, countMailConnections)
sowie ms-oauth-utility-Functions (exchangeCodeForTokens, extractEmailFromId
Token, generate*-Helpers, MS_*-Konstanten) wurden im Code implizit referenziert
aber nicht explizit importiert.

pnpm build:backend hat das nicht gefangen (Nitro Bundle-Step ist toleranter als
strict tsc). Erster Symptom auf staging:

  ReferenceError: createOauthPendingState is not defined
    at .../routes/api/mail/oauth/microsoft/init.post.mjs:36:3

Fix: explizite import-Statements in beiden Endpoints.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-13 21:25:43 +02:00
parent fc69a14f25
commit 7fb76465f0
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,15 @@
import {
consumeOauthPendingState,
countMailConnections,
upsertOauthMicrosoftConnection,
} from "../../../../db/mail";
import { encrypt } from "../../../../utils/crypto";
import {
exchangeCodeForTokens,
extractEmailFromIdToken,
MS_OAUTH_SCOPES,
} from "../../../../utils/ms-oauth";
/**
* POST /api/mail/oauth/microsoft/callback
*

View File

@ -1,3 +1,13 @@
import { createOauthPendingState } from "../../../../db/mail";
import {
MS_AUTH_BASE,
MS_REDIRECT_URI,
MS_OAUTH_SCOPES,
generateCodeVerifier,
computeCodeChallenge,
generateStateId,
} from "../../../../utils/ms-oauth";
/**
* POST /api/mail/oauth/microsoft/init
*