feat(admin): admin panel with overview, users, audit logs, storage, AI config, settings

Sticky sidebar with back-to-app link. Overview: user counts, recipe photos, AI calls/month.
User management with role/tier editing. Audit log (all admin actions).
Storage page with photo breakdown by tier. AI config showing DB vs .env key source.
Site settings page to override .env values at runtime (encrypted in DB).
This commit is contained in:
Arnaud
2026-07-01 08:10:59 +02:00
parent b2d592afe8
commit cba5d9c3ac
14 changed files with 1197 additions and 0 deletions
@@ -0,0 +1,26 @@
import { NextRequest, NextResponse } from "next/server";
import { requireAdmin } from "@/lib/api-auth";
import { sendEmail, verifyEmailHtml } from "@/lib/email";
export async function POST(req: NextRequest) {
const { response } = await requireAdmin();
if (response) return response;
const { to } = await req.json() as { to: string };
if (!to) return NextResponse.json({ error: "Missing 'to'" }, { status: 400 });
try {
await sendEmail({
to,
subject: "Epicure — test email",
html: verifyEmailHtml(`${process.env["BETTER_AUTH_URL"] ?? "http://localhost:3001"}/verify-email?token=test`),
});
return NextResponse.json({
ok: true,
smtp_host: process.env["SMTP_HOST"] ?? null,
smtp_user: process.env["SMTP_USER"] ?? null,
});
} catch (err) {
return NextResponse.json({ error: String(err) }, { status: 500 });
}
}