feat: Version 1.10.0 — DB-Zugriff auf PHP-Bridge (DB4js_all.php) umgestellt
- lib/db.ts entfernt, mysql2-Abhängigkeit gestrichen - lib/phpdb.ts: HTTP-Client für alle DB-Operationen via DB4js_all.php - Alle API-Routen und Server Actions auf phpdb.ts umgestellt - compose.yml / docker-compose.prod.yml: MySQL/phpMyAdmin-Container entfernt - app/api/DB4js_all.php/route.ts: Proxy für Statistik-AJAX-Calls - Statistik-Grafik liest ab 2026 live aus logbuch statt StatistikJahre - PHP 7.3-Kompatibilität: str_contains → strpos Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,8 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { query } from '@/lib/db';
|
||||
import { getSession } from '@/lib/session';
|
||||
import * as phpdb from '@/lib/phpdb';
|
||||
|
||||
export interface FahrkostenRow {
|
||||
ID: number;
|
||||
Kuerzel: string;
|
||||
Name: string;
|
||||
Anzahl: number;
|
||||
}
|
||||
|
||||
const EXCLUDED = "'PrF','Beob','BEOS','TD','ToT'";
|
||||
export type { FahrkostenRow } from '@/lib/phpdb';
|
||||
|
||||
export async function GET(req: Request) {
|
||||
const session = await getSession();
|
||||
@@ -22,18 +15,7 @@ export async function GET(req: Request) {
|
||||
}
|
||||
|
||||
try {
|
||||
const rows = await query(
|
||||
'SELECT b.id AS ID, b.`kürzel` AS Kuerzel,' +
|
||||
' CONCAT(IFNULL(b.vorname, \'\'), IF(b.vorname IS NOT NULL, \' \', \'\'), b.name) AS Name,' +
|
||||
' COUNT(DISTINCT l.ID) AS Anzahl' +
|
||||
' FROM beos b' +
|
||||
' JOIN logbuch_beos lb ON lb.BeoID = b.id' +
|
||||
' JOIN logbuch l ON l.ID = lb.LogbuchID' +
|
||||
' WHERE l.Beginn >= ? AND l.ArtFuehrung NOT IN (' + EXCLUDED + ')' +
|
||||
' GROUP BY b.id, b.`kürzel`, b.name, b.vorname' +
|
||||
' ORDER BY b.name ASC',
|
||||
[ab + ' 00:00:00']
|
||||
) as FahrkostenRow[];
|
||||
const rows = await phpdb.getFahrkosten(ab);
|
||||
return NextResponse.json(rows);
|
||||
} catch (error) {
|
||||
console.error('GET /api/fahrkosten:', error);
|
||||
|
||||
Reference in New Issue
Block a user