feat(domain): sheet document schema v2 — references registry, review_status, vertebral count_range; SQL gate + pgTAP 008
This commit is contained in:
1 parent
6c5b2b7754
commit
3dbbfdf1df
19 files changed
+474
-71
No files matched your search
@@ -21,7 +21,7 @@ returns jsonb
|
||||
language sql
|
||||
as $$
|
||||
select jsonb_build_object(
|
||||
'schema_version', 1,
|
||||
'schema_version', 2,
|
||||
'species_id', 'equine',
|
||||
'name', jsonb_build_object('fr', 'Cheval test', 'en', 'Test horse'),
|
||||
'description', '{}'::jsonb,
|
||||
@@ -30,6 +30,7 @@ as $$
|
||||
'vertebral_config', jsonb_build_object('regions', jsonb_build_array(
|
||||
jsonb_build_object('code', 'C', 'name', jsonb_build_object('fr', 'Cervicales', 'en', 'Cervical'), 'count', 7)
|
||||
)),
|
||||
'references', '[]'::jsonb,
|
||||
'categories', jsonb_build_array(
|
||||
jsonb_build_object('id', 'articulations', 'name', jsonb_build_object('fr', 'Articulations', 'en', 'Joints'), 'color', null)
|
||||
),
|
||||
@@ -160,7 +161,7 @@ select throws_ok(
|
||||
);
|
||||
select throws_ok(
|
||||
$$ update public.anatomical_sheet_versions
|
||||
set content = jsonb_build_object('schema_version', 1, 'species_id', 'equine', 'pad', repeat('x', 2200000))
|
||||
set content = jsonb_build_object('schema_version', 2, 'species_id', 'equine', 'pad', repeat('x', 2200000))
|
||||
where id = pg_temp.id('v1') $$,
|
||||
'23514', null, 'a document over 2 MiB is refused'
|
||||
);
|
||||
@@ -405,7 +406,7 @@ select throws_ok(
|
||||
);
|
||||
select throws_ok(
|
||||
$$ insert into public.anatomical_sheet_versions (sheet_id, version_number, document_schema_version, content)
|
||||
values (pg_temp.id('sheet'), 9, 1, pg_temp.sheet_doc(null)) $$,
|
||||
values (pg_temp.id('sheet'), 9, 2, pg_temp.sheet_doc(null)) $$,
|
||||
'42501', null, 'bob cannot insert a version row directly'
|
||||
);
|
||||
|
||||
@@ -429,7 +430,7 @@ select is(
|
||||
(select count(*) from public.anatomical_sheet_versions where id = pg_temp.id('v3') and content = '{}'::jsonb),
|
||||
0::bigint, 'bob cannot read the draft'
|
||||
);
|
||||
update public.anatomical_sheet_versions set content = '{"schema_version":1}'::jsonb where id = pg_temp.id('v3');
|
||||
update public.anatomical_sheet_versions set content = '{"schema_version":2}'::jsonb where id = pg_temp.id('v3');
|
||||
select throws_ok(
|
||||
$$ select public.fork_anatomical_sheet(pg_temp.id('v3'), 'Copie', 'copie-bob') $$,
|
||||
'42501', null, 'a draft cannot be copied (hidden from non-editors)'
|
||||
@@ -517,7 +518,7 @@ select is(
|
||||
update public.anatomical_sheet_versions set content = '{}'::jsonb where id = pg_temp.id('v2');
|
||||
select is(
|
||||
(select content ->> 'schema_version' from public.anatomical_sheet_versions where id = pg_temp.id('v2')),
|
||||
'1', 'a deprecated version is hidden from editor UPDATE'
|
||||
'2', 'a deprecated version is hidden from editor UPDATE'
|
||||
);
|
||||
reset role;
|
||||
select throws_ok(
|
||||
|
||||
Reference in new issue
Block a user