#60 Can follow citizen

This commit is contained in:
2021-04-17 01:37:32 +02:00
parent 4871e7d780
commit 1c33c026f0
17 changed files with 463 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
create or replace function find_follows_citizen_by_citizen(
_created_by_id uuid,
"limit" int default 50,
"offset" int default 0,
out resource json,
out total int
) language plpgsql as
$$
begin
select json_agg(t), (select count(id) from follow)
into resource, total
from (
select
f.*,
find_citizen_by_id_with_user(f.target_id) as target,
find_citizen_by_id_with_user(f.created_by_id) as created_by
from follow as f
where created_by_id = _created_by_id
order by created_at desc,
f.created_at desc
limit "limit" offset "offset"
) as t;
end;
$$;