Added reading profile endpoint

This commit is contained in:
Sven laptop
2026-07-24 23:50:33 +02:00
parent 9e56f00c1e
commit eaeb0a29bc
7 changed files with 45 additions and 5 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ async function editPost(req, res) {
let updated;
try {
updated = await pool.query(
`UPDATE posts SET ${fields.join(", ")} WHERE id = $${values.length - 1} AND author_id = $${values.length} RETURNING id, title, text, author_id, image_link`,
`WITH updated AS (UPDATE posts SET ${fields.join(", ")} WHERE id = $${values.length - 1} AND author_id = $${values.length} RETURNING id, title, text, author_id, image_link, created_at) SELECT updated.*, people.username AS author_username FROM updated LEFT JOIN people ON people.id = updated.author_id`,
values,
);
} catch (err) {