Major changes: - Docker Compose: full Supabase stack (11 services) equivalent to supabase CLI - Fischerei module: 16 DB tables, waters/species/stocking/catch books/competitions - Sitzungsprotokolle module: meeting protocols, agenda items, task tracking - Verbandsverwaltung module: federation management, member clubs, contacts, fees - Per-account module activation via Modules page toggle - Site Builder: live CMS data in Puck blocks (courses, events, membership registration) - Public registration APIs: course signup, event registration, membership application - Document generation: PDF member cards, Excel reports, HTML labels - Landing page: real Com.BISS content (no filler text) - UX audit fixes: AccountNotFound component, shared status badges, confirm dialog, pagination, duplicate heading removal, emoji→badge replacement, a11y fixes - QA: healthcheck fix, API auth fix, enum mismatch fix, password required attribute
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
|
|
|
|
export async function POST(request: Request) {
|
|
try {
|
|
const body = await request.json();
|
|
const {
|
|
accountId,
|
|
firstName,
|
|
lastName,
|
|
email,
|
|
phone,
|
|
street,
|
|
postalCode,
|
|
city,
|
|
dateOfBirth,
|
|
message,
|
|
} = body;
|
|
|
|
if (!accountId || !firstName || !lastName || !email) {
|
|
return NextResponse.json(
|
|
{
|
|
error:
|
|
'Konto-ID, Vorname, Nachname und E-Mail sind erforderlich',
|
|
},
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
|
return NextResponse.json(
|
|
{ error: 'Ungültige E-Mail-Adresse' },
|
|
{ status: 400 },
|
|
);
|
|
}
|
|
|
|
const supabase = getSupabaseServerAdminClient();
|
|
|
|
const { error } = await supabase.from('membership_applications').insert({
|
|
account_id: accountId,
|
|
first_name: firstName,
|
|
last_name: lastName,
|
|
email,
|
|
phone: phone || null,
|
|
street: street || null,
|
|
postal_code: postalCode || null,
|
|
city: city || null,
|
|
date_of_birth: dateOfBirth || null,
|
|
message: message || null,
|
|
status: 'submitted',
|
|
});
|
|
|
|
if (error) {
|
|
console.error('[membership-apply] Insert error:', error.message);
|
|
return NextResponse.json(
|
|
{ error: 'Bewerbung fehlgeschlagen' },
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
message: 'Bewerbung erfolgreich eingereicht',
|
|
});
|
|
} catch (err) {
|
|
console.error('[membership-apply] Error:', err);
|
|
return NextResponse.json({ error: 'Serverfehler' }, { status: 500 });
|
|
}
|
|
}
|