feature #7: add find_comment_by_id query

This commit is contained in:
2019-08-27 12:53:34 +02:00
parent ff76bd55ef
commit b2230f2fed
2 changed files with 5 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ begin
insert into "user" (id, username, password, blocked_at, roles) insert into "user" (id, username, password, blocked_at, roles)
select select
uuid_in(md5('user'||rn::text)::cstring), uuid_in(md5('user'||rn::text)::cstring),
'username' || rn, 'username-' || rn,
_password, _password,
case when rn % 10 = 0 then now() else null end, case when rn % 10 = 0 then now() else null end,
case when rn % 2 = 0 then '{ROLE_USER}'::text[] else '{ROLE_ADMIN}'::text[] end case when rn % 2 = 0 then '{ROLE_USER}'::text[] else '{ROLE_ADMIN}'::text[] end

View File

@@ -32,6 +32,7 @@ declare
_selected_comments_total int; _selected_comments_total int;
_find_comments_by_target_result json; _find_comments_by_target_result json;
_find_comments_by_parent_result json; _find_comments_by_parent_result json;
_find_comments_by_id_result json;
begin begin
-- insert user for context -- insert user for context
select insert_user(created_user) into created_user; select insert_user(created_user) into created_user;
@@ -55,6 +56,9 @@ begin
) into _comment_id; ) into _comment_id;
assert (select count(*) = 1 from "comment"), 'comment must be inserted'; assert (select count(*) = 1 from "comment"), 'comment must be inserted';
select find_comment_by_id(_comment_id) into _find_comments_by_id_result;
assert (_find_comments_by_id_result->>'content' = 'Ho my god !'), 'content of comment must be "Ho my god !"';
perform edit_comment( perform edit_comment(
reference => 'article'::regclass, reference => 'article'::regclass,
id => _comment_id, id => _comment_id,