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:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user