Web app ready

This commit is contained in:
2026-06-06 17:08:04 +02:00
parent ff187a5bd4
commit 3e127afbae
39 changed files with 2622 additions and 123 deletions
+32
View File
@@ -0,0 +1,32 @@
import { NextResponse } from 'next/server';
import db from '@/lib/db';
export const dynamic = 'force-dynamic';
// Body: { counters?: { id: number; order_index: number; group_id: number | null }[], groups?: { id: number; order_index: number }[] }
export async function PUT(request: Request) {
const { counters, groups } = await request.json();
const updateCounters = db.prepare(
'UPDATE counters SET order_index = ?, group_id = ? WHERE id = ?'
);
const updateGroups = db.prepare(
'UPDATE groups SET order_index = ? WHERE id = ?'
);
const reorderAll = db.transaction(() => {
if (Array.isArray(counters)) {
for (const c of counters) {
updateCounters.run(c.order_index, c.group_id ?? null, c.id);
}
}
if (Array.isArray(groups)) {
for (const g of groups) {
updateGroups.run(g.order_index, g.id);
}
}
});
reorderAll();
return new NextResponse(null, { status: 204 });
}