feat(fristenrechner/cascade): more opponent-side proceeding types

m's 2026-05-08 17:41 batch Item 4: today
`cms-eingang.gegenseite` exposes UPC INF/REV, DE INF/NULL, EPA OPP/APP,
DPMA OPP — but is missing the appellate / interim-measures arms m
named. m: "we need a lot more proceeding types for Opponent submission
— we currently only see Verletzungsverfahren."

Migration 069 adds 5 new parent nodes and 17 leaves under
`cms-eingang.gegenseite`:

  - upc-app             UPC Berufungsverfahren — 5 leaves: Berufungs-
                        schrift, -begründung, -erwiderung, Anschluss-
                        berufung (R.237), Erwiderung dazu (R.238).
                        Concepts: notice-of-appeal, statement-of-
                        grounds-of-appeal, response-to-appeal,
                        cross-appeal, reply-to-cross-appeal.
  - upc-pi              UPC einstweilige Maßnahmen — 2 leaves: PI-
                        Antrag, PI-Erwiderung. Concepts: application-
                        for-provisional-measures, statement-of-defence.
  - de-bgh-inf          DE Revision / NZB BGH (Verletzung) — 5 leaves:
                        NZB, NZB-Begründung, Revisionsschrift,
                        Revisionsbegründung, Revisionserwiderung.
                        Concepts: nichtzulassungsbeschwerde,
                        nichtzulassungsbeschwerde-begruendung,
                        revisionsfrist, revisionsbegruendung,
                        response-to-appeal.
  - de-bgh-null         DE Berufung BGH (Nichtigkeit) — 3 leaves:
                        Berufungsschrift, -begründung, -erwiderung.
                        Concepts: notice-of-appeal,
                        statement-of-grounds-of-appeal,
                        response-to-appeal.
  - dpma-bgh            DPMA Rechtsbeschwerde BGH — 2 leaves:
                        Rechtsbeschwerde, RB-Begründung. Concepts:
                        rechtsbeschwerde, rechtsbeschwerde-begruendung.

Each parent + leaf carries the matching forums tag so the
inbox-channel chip (#15) hides / shows the subtree correctly. The
event_category_concepts junction sets proceeding_type_code per leaf
(UPC_APP / UPC_PI / DE_INF_BGH / DE_NULL_BGH / DPMA_BGH_RB) so the
result card pills only the relevant proceeding's rules.

All INSERTs use ON CONFLICT (slug) DO UPDATE so re-running the
migration after a partial apply is safe. Mig applied to live Supabase;
tracker at v69.

Refs m/paliad#15.
This commit is contained in:
m
2026-05-08 19:20:52 +02:00
parent e2907db760
commit fdbbc74c15
2 changed files with 264 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
-- Reverse t-paliad-157 / m's batch Item 4: drop the new opponent-side
-- cascade entries and their concept junctions.
DELETE FROM paliad.event_category_concepts
WHERE event_category_id IN (
SELECT id FROM paliad.event_categories
WHERE slug LIKE 'cms-eingang.gegenseite.upc-app.%'
OR slug LIKE 'cms-eingang.gegenseite.upc-pi.%'
OR slug LIKE 'cms-eingang.gegenseite.de-bgh-inf.%'
OR slug LIKE 'cms-eingang.gegenseite.de-bgh-null.%'
OR slug LIKE 'cms-eingang.gegenseite.dpma-bgh.%'
);
DELETE FROM paliad.event_categories
WHERE slug LIKE 'cms-eingang.gegenseite.upc-app%'
OR slug LIKE 'cms-eingang.gegenseite.upc-pi%'
OR slug LIKE 'cms-eingang.gegenseite.de-bgh-inf%'
OR slug LIKE 'cms-eingang.gegenseite.de-bgh-null%'
OR slug LIKE 'cms-eingang.gegenseite.dpma-bgh%';

View File

@@ -0,0 +1,245 @@
-- t-paliad-157 / m's 2026-05-08 batch Item 4: more opponent-side
-- proceeding types in the B1 cascade.
--
-- Today `cms-eingang.gegenseite` exposes UPC INF/REV, DE INF/NULL, EPA
-- OPP/APP, DPMA OPP — but is missing the appellate / interim-measures
-- arms m named: UPC Berufung, UPC einstweilige Maßnahmen, DE BGH
-- (Revision/NZB), DE BGH-Berufung Nichtigkeit, DPMA Rechtsbeschwerde.
-- Each parent gets a few concrete leaves wired to the relevant
-- deadline_concepts so the result-card pills land on the right rules.
--
-- forums tag matches the parent jurisdiction so the inbox-channel chip
-- (m/paliad#15) correctly shows / hides each subtree.
--
-- proceeding_type_code on each junction row narrows the result card to
-- the relevant proceeding (so the user picking "DE BGH Revision" sees
-- DE_INF_BGH pills, not all proceedings sharing the underlying
-- concept).
--
-- Idempotent: every INSERT uses ON CONFLICT (slug) DO UPDATE / DO
-- NOTHING so re-running the migration after a partial apply is safe.
-- ============================================================================
-- 1. New parent nodes under cms-eingang.gegenseite
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, step_question_de, step_question_en,
sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.upc-app',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite'),
'UPC Berufungsverfahren',
'UPC Appeal',
'Welcher Schriftsatz?',
'Which submission?',
250, false, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-pi',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite'),
'UPC einstweilige Maßnahmen',
'UPC Provisional Measures',
'Welcher Schriftsatz?',
'Which submission?',
280, false, true, ARRAY['upc']),
('cms-eingang.gegenseite.de-bgh-inf',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite'),
'DE Revision / NZB BGH (Verletzung)',
'DE Revision / NZB BGH (infringement)',
'Welcher Schriftsatz?',
'Which submission?',
320, false, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-null',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite'),
'DE Berufung BGH (Nichtigkeit)',
'DE Appeal BGH (nullity)',
'Welcher Schriftsatz?',
'Which submission?',
450, false, true, ARRAY['de']),
('cms-eingang.gegenseite.dpma-bgh',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite'),
'DPMA Rechtsbeschwerde BGH',
'DPMA Rechtsbeschwerde BGH',
'Welcher Schriftsatz?',
'Which submission?',
750, false, true, ARRAY['dpma'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
step_question_de = EXCLUDED.step_question_de,
step_question_en = EXCLUDED.step_question_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 2. UPC_APP children
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.upc-app.berufungsschrift',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-app'),
'Berufungsschrift', 'Notice of Appeal', 100, true, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-app.berufungsbegruendung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-app'),
'Berufungsbegründung', 'Statement of Grounds', 200, true, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-app.berufungserwiderung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-app'),
'Berufungserwiderung', 'Response to Appeal', 300, true, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-app.anschlussberufung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-app'),
'Anschlussberufung (R.237)', 'Cross-Appeal (R.237)', 400, true, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-app.reply-to-cross-appeal',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-app'),
'Erwiderung Anschlussberufung (R.238)', 'Reply to Cross-Appeal (R.238)', 500, true, true, ARRAY['upc'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 3. UPC_PI children
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.upc-pi.antrag',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-pi'),
'Antrag auf einstw. Maßnahmen', 'Application for Provisional Measures', 100, true, true, ARRAY['upc']),
('cms-eingang.gegenseite.upc-pi.erwiderung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.upc-pi'),
'Erwiderung', 'Statement of Defence (PI)', 200, true, true, ARRAY['upc'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 4. DE_INF_BGH children
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.de-bgh-inf.nzb',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-inf'),
'Nichtzulassungsbeschwerde', 'Non-Admission Appeal (NZB)', 100, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-inf.nzb-begr',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-inf'),
'NZB-Begründung', 'NZB Statement of Grounds', 200, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-inf.revision',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-inf'),
'Revisionsschrift', 'Notice of Revision', 300, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-inf.revisionsbegr',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-inf'),
'Revisionsbegründung', 'Revision Statement of Grounds', 400, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-inf.revisionserw',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-inf'),
'Revisionserwiderung', 'Response to Revision', 500, true, true, ARRAY['de'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 5. DE_NULL_BGH children
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.de-bgh-null.berufung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-null'),
'Berufungsschrift', 'Notice of Appeal', 100, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-null.begruendung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-null'),
'Berufungsbegründung', 'Statement of Grounds of Appeal', 200, true, true, ARRAY['de']),
('cms-eingang.gegenseite.de-bgh-null.erwiderung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.de-bgh-null'),
'Berufungserwiderung', 'Response to Appeal', 300, true, true, ARRAY['de'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 6. DPMA_BGH_RB children
-- ============================================================================
INSERT INTO paliad.event_categories
(slug, parent_id, label_de, label_en, sort_order, is_leaf, is_active, forums)
VALUES
('cms-eingang.gegenseite.dpma-bgh.rechtsbeschwerde',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.dpma-bgh'),
'Rechtsbeschwerde', 'Rechtsbeschwerde', 100, true, true, ARRAY['dpma']),
('cms-eingang.gegenseite.dpma-bgh.begruendung',
(SELECT id FROM paliad.event_categories WHERE slug = 'cms-eingang.gegenseite.dpma-bgh'),
'Rechtsbeschwerde-Begründung', 'Rechtsbeschwerde Statement of Grounds', 200, true, true, ARRAY['dpma'])
ON CONFLICT (slug) DO UPDATE SET
parent_id = EXCLUDED.parent_id,
label_de = EXCLUDED.label_de,
label_en = EXCLUDED.label_en,
sort_order = EXCLUDED.sort_order,
is_leaf = EXCLUDED.is_leaf,
is_active = EXCLUDED.is_active,
forums = EXCLUDED.forums,
updated_at = now();
-- ============================================================================
-- 7. Junctions: leaves → deadline_concepts (with proceeding_type_code
-- narrowing so each result card pills only the relevant proceeding).
-- ============================================================================
INSERT INTO paliad.event_category_concepts (event_category_id, concept_id, proceeding_type_code, sort_order)
SELECT ec.id, dc.id, mapping.proc, 100
FROM (VALUES
('cms-eingang.gegenseite.upc-app.berufungsschrift', 'notice-of-appeal', 'UPC_APP'),
('cms-eingang.gegenseite.upc-app.berufungsbegruendung', 'statement-of-grounds-of-appeal', 'UPC_APP'),
('cms-eingang.gegenseite.upc-app.berufungserwiderung', 'response-to-appeal', 'UPC_APP'),
('cms-eingang.gegenseite.upc-app.anschlussberufung', 'cross-appeal', 'UPC_APP'),
('cms-eingang.gegenseite.upc-app.reply-to-cross-appeal', 'reply-to-cross-appeal', 'UPC_APP'),
('cms-eingang.gegenseite.upc-pi.antrag', 'application-for-provisional-measures', 'UPC_PI'),
('cms-eingang.gegenseite.upc-pi.erwiderung', 'statement-of-defence', 'UPC_PI'),
('cms-eingang.gegenseite.de-bgh-inf.nzb', 'nichtzulassungsbeschwerde', 'DE_INF_BGH'),
('cms-eingang.gegenseite.de-bgh-inf.nzb-begr', 'nichtzulassungsbeschwerde-begruendung', 'DE_INF_BGH'),
('cms-eingang.gegenseite.de-bgh-inf.revision', 'revisionsfrist', 'DE_INF_BGH'),
('cms-eingang.gegenseite.de-bgh-inf.revisionsbegr', 'revisionsbegruendung', 'DE_INF_BGH'),
('cms-eingang.gegenseite.de-bgh-inf.revisionserw', 'response-to-appeal', 'DE_INF_BGH'),
('cms-eingang.gegenseite.de-bgh-null.berufung', 'notice-of-appeal', 'DE_NULL_BGH'),
('cms-eingang.gegenseite.de-bgh-null.begruendung', 'statement-of-grounds-of-appeal', 'DE_NULL_BGH'),
('cms-eingang.gegenseite.de-bgh-null.erwiderung', 'response-to-appeal', 'DE_NULL_BGH'),
('cms-eingang.gegenseite.dpma-bgh.rechtsbeschwerde', 'rechtsbeschwerde', 'DPMA_BGH_RB'),
('cms-eingang.gegenseite.dpma-bgh.begruendung', 'rechtsbeschwerde-begruendung', 'DPMA_BGH_RB')
) AS mapping(leaf_slug, concept_slug, proc)
JOIN paliad.event_categories ec ON ec.slug = mapping.leaf_slug
JOIN paliad.deadline_concepts dc ON dc.slug = mapping.concept_slug
ON CONFLICT DO NOTHING;