Add validation on route CreateComments & EditComment
rename POST /comments/{comment}/children
method edit and create comment of repository return edited/created comment
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
create or replace function comment(reference regclass, resource json, out _id uuid)
|
||||
create or replace function comment(reference regclass, inout resource json)
|
||||
language plpgsql as
|
||||
$$
|
||||
declare
|
||||
@@ -17,7 +17,8 @@ begin
|
||||
else
|
||||
raise exception 'comment with target as "%", is not implemented', reference::text;
|
||||
end if;
|
||||
_id = _new_id;
|
||||
|
||||
select find_comment_by_id(_new_id) into resource;
|
||||
end;
|
||||
$$;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
create or replace function edit_comment(_id uuid, _content text) returns void
|
||||
create or replace function edit_comment(_id uuid, _content text, out resource json)
|
||||
language plpgsql as
|
||||
$$
|
||||
begin
|
||||
update comment c set
|
||||
"content" = _content
|
||||
where c.id = _id;
|
||||
|
||||
select find_comment_by_id(_id) into resource;
|
||||
end;
|
||||
$$;
|
||||
|
||||
Reference in New Issue
Block a user