Update index.js

This commit is contained in:
fcarraUniSa
2026-02-17 10:28:36 +01:00
committed by GitHub
parent 0783e3c12a
commit 3fd772210b

View File

@@ -229,7 +229,7 @@ app.post('/api/surveys', async (req, res) => {
try {
await query(
'INSERT INTO survey_results (id, rating, comment, source, reference_id) VALUES (?, ?, ?, ?, ?)',
[id, rating, comment, source, referenceId || null]
[id, rating, comment || null, source, referenceId || null]
);
res.json({ success: true, id });
} catch (e) {
@@ -244,7 +244,7 @@ app.post('/api/articles', async (req, res) => {
try {
await query(
'INSERT INTO kb_articles (id, title, content, category, type, url, source) VALUES (?, ?, ?, ?, ?, ?, ?)',
[id, title, content, category, type, url, source]
[id, title, content, category, type, url || null, source || 'manual']
);
res.json({ success: true, id, lastUpdated: new Date().toISOString() });
} catch (e) {
@@ -258,7 +258,7 @@ app.patch('/api/articles/:id', async (req, res) => {
try {
await query(
'UPDATE kb_articles SET title=?, content=?, category=?, type=?, url=? WHERE id=?',
[title, content, category, type, url, id]
[title, content, category, type, url || null, id]
);
res.json({ success: true });
} catch (e) {