Add account hierarchy framework with migrations, RLS policies, and UI components

This commit is contained in:
T. Zehetbauer
2026-03-31 22:18:04 +02:00
parent 7e7da0b465
commit 59546ad6d2
262 changed files with 11671 additions and 3927 deletions

View File

@@ -1,27 +1,40 @@
import { NextResponse } from 'next/server';
import { getLogger } from '@kit/shared/logger';
export async function POST(request: Request) {
const logger = await getLogger();
try {
const body = await request.json();
const { recipientEmail, name, email, subject, message } = body;
if (!email || !message) {
return NextResponse.json({ error: 'E-Mail und Nachricht sind erforderlich' }, { status: 400 });
return NextResponse.json(
{ error: 'E-Mail und Nachricht sind erforderlich' },
{ status: 400 },
);
}
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
return NextResponse.json({ error: 'Ungültige E-Mail-Adresse' }, { status: 400 });
return NextResponse.json(
{ error: 'Ungültige E-Mail-Adresse' },
{ status: 400 },
);
}
// In production: use @kit/mailers to send the email
// For now: log and return success
console.log('[contact] Form submission:', {
to: recipientEmail || 'admin',
from: email,
name,
subject: subject || 'Kontaktanfrage',
message,
});
logger.info(
{
to: recipientEmail || 'admin',
from: email,
name,
subject: subject || 'Kontaktanfrage',
message,
},
'[contact] Form submission',
);
// TODO: Wire to @kit/mailers
// const mailer = await getMailer();
@@ -34,7 +47,7 @@ export async function POST(request: Request) {
return NextResponse.json({ success: true, message: 'Nachricht gesendet' });
} catch (err) {
console.error('[contact] Error:', err);
logger.error({ error: err, context: 'contact' }, '[contact] Error');
return NextResponse.json({ error: 'Serverfehler' }, { status: 500 });
}
}