UpdateENtry needs to know what userid to update

This commit is contained in:
Aaron Bieber 2020-04-15 07:40:11 -06:00
parent 9bd46d33c3
commit a854a5f4a9

View File

@ -8,9 +8,10 @@ RETURNING entry_id, created_at, to_tsvector(body);
-- name: UpdateEntry :execrows
UPDATE entries SET
title = $2,
body = $3
WHERE entry_id = $1;
title = $3,
body = $4
WHERE entry_id = $1 and
user_id = $2;
-- name: GetEntry :one
SELECT * FROM entries
@ -27,7 +28,7 @@ WHERE entry_id = $1;
-- name: SimilarEntries :many
SELECT entry_id, similarity(body, $2) as similarity,
ts_headline('english', body, q) as headline,
ts_headline('english', body, q, 'StartSel = <b>, StopSel = </b>') as headline,
title from entries,
to_tsquery($2) q
WHERE user_id = $1 and