Update index.js
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user