Nichtbetrachten und Daten zusammen

This commit is contained in:
2026-08-16 07:55:51 +00:00
parent 550da31038
commit 90a7d8d3d2
10 changed files with 2415 additions and 489 deletions

View File

@@ -0,0 +1,30 @@
import { NextRequest, NextResponse } from 'next/server';
import { query } from '@/lib/db';
export const dynamic = 'force-dynamic';
export async function GET(req: NextRequest, { params }: { params: { id: string } }) {
try {
const { id } = params;
const res = await query(
`SELECT
id,
price_numeric::float AS price,
price_per_night::float AS price_per_night,
price_per_person::float AS price_per_person,
nights,
persons,
tracked_at AS created_at
FROM hotel_price_history
WHERE hotel_id::text = $1::text
ORDER BY tracked_at ASC`,
[id]
);
return NextResponse.json({ success: true, prices: res.rows });
} catch (error: any) {
console.error('Fehler beim Laden der Preishistorie:', error.message);
return NextResponse.json({ success: false, error: error.message, prices: [] }, { status: 500 });
}
}