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 -- name: UpdateEntry :execrows
UPDATE entries SET UPDATE entries SET
title = $2, title = $3,
body = $3 body = $4
WHERE entry_id = $1; WHERE entry_id = $1 and
user_id = $2;
-- name: GetEntry :one -- name: GetEntry :one
SELECT * FROM entries SELECT * FROM entries
@ -27,7 +28,7 @@ WHERE entry_id = $1;
-- name: SimilarEntries :many -- name: SimilarEntries :many
SELECT entry_id, similarity(body, $2) as similarity, 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, title from entries,
to_tsquery($2) q to_tsquery($2) q
WHERE user_id = $1 and WHERE user_id = $1 and