mirror of https://github.com/artifacthub/hub.git
Coalesce get organization members results (#1397)
Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
This commit is contained in:
parent
4d80f53d00
commit
de48fe5c4a
|
|
@ -20,12 +20,12 @@ begin
|
|||
where o.name = p_org_name
|
||||
)
|
||||
select
|
||||
json_agg(json_strip_nulls(json_build_object(
|
||||
coalesce(json_agg(json_strip_nulls(json_build_object(
|
||||
'alias', alias,
|
||||
'first_name', first_name,
|
||||
'last_name', last_name,
|
||||
'confirmed', confirmed
|
||||
))),
|
||||
))), '[]'),
|
||||
(select count(*) from organization_members)
|
||||
from (
|
||||
select *
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
-- Start transaction and plan tests
|
||||
begin;
|
||||
select plan(3);
|
||||
select plan(4);
|
||||
|
||||
-- Declare some variables
|
||||
\set user1ID '00000000-0000-0000-0000-000000000001'
|
||||
|
|
@ -67,6 +67,16 @@ select results_eq(
|
|||
$$,
|
||||
'Limit and offset of 1 used, member user2 returned'
|
||||
);
|
||||
select results_eq(
|
||||
$$
|
||||
select data::jsonb, total_count::integer
|
||||
from get_organization_members('00000000-0000-0000-0000-000000000001', 'org1', 0, 2)
|
||||
$$,
|
||||
$$
|
||||
values ('[]'::jsonb, 2)
|
||||
$$,
|
||||
'No members expected when using an offset of 2'
|
||||
);
|
||||
select throws_ok(
|
||||
$$ select * from get_organization_members('00000000-0000-0000-0000-000000000001', 'org2', 0, 0) $$,
|
||||
42501,
|
||||
|
|
|
|||
Loading…
Reference in New Issue