feat: user portal with trips, wifi, welcome message, chat; admin trips & messages mgmt

This commit is contained in:
2026-06-28 23:33:39 -05:00
parent 658a3f00a7
commit 291df16f1f
7 changed files with 657 additions and 142 deletions
+12 -1
View File
@@ -2,7 +2,7 @@ import { NextResponse } from 'next/server';
import { requireRole } from '@/lib/auth';
import { db } from '@/lib/db';
export const dynamic = 'force-dynamic'; // Prevents static generation
export const dynamic = 'force-dynamic';
export async function GET() {
try {
@@ -32,12 +32,23 @@ export async function GET() {
);
const wifiPassword = configRows[0]?.value || '';
// Get user's trips (future and current)
const { rows: trips } = await db.query(
`SELECT t.id, t.room_id, t.check_in, t.check_out, t.notes, t.status, r.name as room_name
FROM trips t
LEFT JOIN rooms r ON t.room_id = r.id
WHERE t.user_id = $1 AND t.check_out >= CURRENT_DATE
ORDER BY t.check_in ASC`,
[userId]
);
return NextResponse.json({
reservations,
coupons,
offers,
benefits: benefits.map((b: { text: string }) => b.text),
wifiPassword,
trips,
});
} catch (error) {
if ((error as Error).message === 'Unauthorized') {