feat: initial commit web-cad-neu with docker-compose, frontend and backend

This commit is contained in:
2026-06-26 10:50:24 +02:00
commit 4ec76fe406
102 changed files with 25722 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
/**
* Settings Routes key/value application settings
*/
import type { FastifyInstance } from 'fastify';
import type { DatabaseInterface } from '../database/DatabaseInterface.js';
export function registerSettingsRoutes(fastify: FastifyInstance, db: DatabaseInterface) {
// Get a single setting by key
fastify.get('/api/settings/:key', async (request, reply) => {
const { key } = request.params as { key: string };
const setting = db.getSetting(key);
if (!setting) return reply.code(404).send({ error: 'Setting not found' });
return setting;
});
// Create or update a setting (upsert)
fastify.put('/api/settings/:key', async (request) => {
const { key } = request.params as { key: string };
const body = request.body as { value?: string };
if (body.value === undefined) {
return { error: 'Value is required' };
}
db.setSetting(key, body.value);
return { key, value: body.value, updated_at: new Date().toISOString() };
});
}