This commit is contained in:
lejay
2026-02-13 00:21:53 +01:00
parent 81d2412835
commit 6923c319a1
85 changed files with 17836 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import pool from '../db/index.js';
export async function getSettings(req, res) {
try {
const { rows } = await pool.query('SELECT key, value FROM settings');
const obj = {};
for (const r of rows) {
let v = r.value;
if (typeof v === 'string' && /^\d+$/.test(v)) v = Number(v);
obj[r.key] = v;
}
res.json(obj);
} catch (err) {
res.status(500).json({ error: err.message });
}
}