refactoring: move sql files
This commit is contained in:
17
resources/sql/functions/citizen/find_citizen_by_id.sql
Normal file
17
resources/sql/functions/citizen/find_citizen_by_id.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
create or replace function find_citizen_by_id(in id uuid, out resource json) language plpgsql as
|
||||
$$
|
||||
declare
|
||||
_id alias for id;
|
||||
begin
|
||||
select to_json(t) into resource
|
||||
from (
|
||||
select
|
||||
z.*,
|
||||
find_user_by_id(z.user_id) as "user"
|
||||
from citizen as z
|
||||
where z.id = _id
|
||||
) as t;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- drop function if exists find_citizen_by_id(uuid, inout json);
|
||||
Reference in New Issue
Block a user