#54 Can create article under the name of the Workgroup

This commit is contained in:
2020-07-10 15:41:39 +02:00
parent 3d319605de
commit 01c3d85a17
6 changed files with 40 additions and 9 deletions

View File

@@ -7,9 +7,15 @@ begin
from (
select
z.*,
find_user_by_id(z.user_id) as "user"
find_user_by_id(z.user_id) as "user",
case when ciw.workgroup_id is null then '{}' else array_agg(json_build_object(
'roles', ciw.roles,
'workgroup', find_workgroup_by_id_simple(ciw.workgroup_id)
)) end as "workgroups"
from citizen as z
left join citizen_in_workgroup ciw on z.id = ciw.citizen_id
where z.user_id = _user_id
group by z.id, ciw.workgroup_id
) as t;
end;
$$;