Files
logbuch/app/api/beos/route.ts
Reinhard X. Fürst 12be2f1db2 Adapt to existing beos table in database sternwarte
Column mapping: id, name/vorname, kürzel (with umlaut), pw instead of
the planned schema. DB_NAME changed to sternwarte. create_table.sql
no longer creates beos, only the three new logbuch tables.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 17:34:45 +02:00

15 lines
573 B
TypeScript

import { NextResponse } from 'next/server';
import { query } from '@/lib/db';
export async function GET() {
try {
const rows = await query(
'SELECT id AS ID, `kürzel` AS Kuerzel, CONCAT(IFNULL(vorname, \'\'), IF(vorname IS NOT NULL, \' \', \'\'), name) AS Name FROM beos WHERE `kürzel` IS NOT NULL ORDER BY name ASC'
) as { ID: number; Kuerzel: string; Name: string }[];
return NextResponse.json(rows);
} catch (error) {
console.error('GET /api/beos:', error);
return NextResponse.json({ error: 'Datenbankfehler' }, { status: 500 });
}
}