Add rooms, menu, places, reviews APIs and site config bulk endpoint

This commit is contained in:
2026-06-27 18:06:31 -05:00
parent 3294471a94
commit 4bb3596412
13 changed files with 454 additions and 2 deletions
+11
View File
@@ -1,5 +1,16 @@
import { NextRequest, NextResponse } from 'next/server';
import { requireRole, createUser } from '@/lib/auth';
import { db } from '@/lib/db';
export async function GET() {
try {
await requireRole('admin');
const { rows } = await db.query('SELECT id, username, role, created_at FROM users ORDER BY created_at DESC');
return NextResponse.json({ data: rows });
} catch (err: any) {
return NextResponse.json({ error: err.message || 'Failed to fetch users' }, { status: err.message === 'Unauthorized' ? 401 : 500 });
}
}
export async function POST(request: NextRequest) {
try {