From a854a5f4a9480a4b97c33ef9628cf57a6d0e8a85 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 15 Apr 2020 07:40:11 -0600 Subject: [PATCH] UpdateENtry needs to know what userid to update --- sql/queries/queries.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sql/queries/queries.sql b/sql/queries/queries.sql index a2de6e2..f51d613 100644 --- a/sql/queries/queries.sql +++ b/sql/queries/queries.sql @@ -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 = , StopSel = ') as headline, title from entries, to_tsquery($2) q WHERE user_id = $1 and