Adjusted SMTP

This commit is contained in:
2026-04-11 12:21:34 +02:00
parent 9a96d74f5c
commit 97b483c121
9 changed files with 339 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ import {
getTenantRequestByOrgId,
} from "@/lib/db";
import { getTenant, listTenants } from "@/lib/k8s";
import { sendAdminNotificationEmail } from "@/lib/email";
import type { OnboardingInput } from "@/types";
import { z } from "zod";
@@ -87,6 +88,7 @@ export async function GET() {
* POST /api/onboarding
* Submit the onboarding wizard. Creates a tenant_request with status "pending".
* The actual PiecedTenant CR is NOT created yet — admin approval required.
* Sends a notification email to the admin.
*/
export async function POST(request: Request) {
const user = await getSessionUser();
@@ -138,6 +140,13 @@ export async function POST(request: Request) {
billingNotes: input.billingNotes,
});
// Notify admin about the new request
await sendAdminNotificationEmail(
user.orgName,
user.name || user.email,
user.email
);
return NextResponse.json(
{ message: "Onboarding request submitted.", request: tenantRequest },
{ status: 201 }