refactor: move v1 API + CRM event-type un-hardcoding to a follow-up PR

Keeps #801 scoped to the setup-wizard event-types feature and its
load-bearing guards. The v1 validator/discovery endpoint and the
contract-conversion default fix ship separately so the public-API
behavior change gets its own review weight.
This commit is contained in:
Paul Nothaft
2026-07-15 22:30:00 +02:00
parent f8ba669716
commit 93301002ba
6 changed files with 23 additions and 123 deletions
@@ -11,8 +11,6 @@
* - reminder-template self-heal does NOT resurrect templates for slugs
* that no longer exist in the catalog
* - after markSetupWizardCompleted() → system deletion is refused again
* - resolveDefaultEventType never returns a hardcoded slug that the
* admin removed (contract→event conversion default, #800)
*/
const { bootCrmDb } = require('./helpers/crmDb');
@@ -109,21 +107,6 @@ describe('event type deletion during the setup window (#800)', () => {
expect(result.success).toBe(true);
});
it('resolveDefaultEventType follows the catalog instead of hardcoding a slug', async () => {
// 'other' is active → preferred catch-all.
expect(await eventTypeService.resolveDefaultEventType()).toBe('other');
// Deactivate 'other' → falls over to the first active type by display order.
const other = await db('event_types').where({ slug_prefix: 'other' }).first();
await db('event_types').where({ id: other.id }).update({ is_active: 0 });
const resolved = await eventTypeService.resolveDefaultEventType();
expect(resolved).not.toBe('other');
const resolvedRow = await db('event_types').where({ slug_prefix: resolved }).first();
expect(resolvedRow).toBeTruthy();
await db('event_types').where({ id: other.id }).update({ is_active: 1 });
});
it('fails closed when the completion marker row is missing', async () => {
// A portable-backup restore can replace app_settings with a set that
// predates migration 161 (which will not rerun) — absence must mean