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

@@ -1,10 +1,12 @@
import { NextResponse } from "next/server";
import { requirePlatformRole } from "@/lib/session";
import { listTenantRequests } from "@/lib/db";
import { listTenantRequests, syncProvisioningStatuses } from "@/lib/db";
import { getTenant } from "@/lib/k8s";
/**
* GET /api/admin/requests
* List all tenant requests. Optionally filter by ?status=pending
* Auto-syncs "provisioning" → "active" when the PiecedTenant CR is Ready.
*/
export async function GET(request: Request) {
try {
@@ -13,6 +15,12 @@ export async function GET(request: Request) {
return NextResponse.json({ error: "Forbidden" }, { status: 403 });
}
// Sync provisioning statuses before listing
await syncProvisioningStatuses(async (tenantName: string) => {
const tenant = await getTenant(tenantName);
return tenant?.status?.phase ?? null;
});
const { searchParams } = new URL(request.url);
const status = searchParams.get("status") as any;