Dashboard with YAML

This commit is contained in:
2026-04-19 18:03:14 +01:00
commit 9ed7f34c44
29 changed files with 26677 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import { readDb, writeDb } from '../utils/yamlDb';
export default defineEventHandler(async (event) => {
const body = await readBody(event);
if (!body.items || !Array.isArray(body.items)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid items array' });
}
const items = readDb();
// Expecting body.items: { id: string, type: 'folder' | 'link', order: number }[]
for (const updateItem of body.items) {
const existing = items.find(i => i.id === updateItem.id);
if (existing) {
existing.order = updateItem.order;
}
}
writeDb(items);
return { success: true };
});