Fix social sync: update post_title and post_url on existing posts

Previously only INSERT included these fields, UPDATE ignored them.

Chronicler #76
This commit is contained in:
Claude
2026-04-10 22:20:06 +00:00
parent 274edccf8a
commit 74f7876955

View File

@@ -78,6 +78,18 @@ router.post('/social/sync', async (req, res) => {
const updateValues = [];
let paramIndex = 1;
// Update title and URL if provided
if (post_title) {
updateFields.push(`post_title = $${paramIndex}`);
updateValues.push(post_title);
paramIndex++;
}
if (post_url) {
updateFields.push(`post_url = $${paramIndex}`);
updateValues.push(post_url);
paramIndex++;
}
// Build dynamic update based on provided metrics
if (metrics) {
const metricFields = [