diff --git a/backend/index.js b/backend/index.js index 9d9316c..945940b 100644 --- a/backend/index.js +++ b/backend/index.js @@ -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) {