This commit is contained in:
2026-01-20 02:06:16 +01:00
parent 06dddedef6
commit da290a8ff8
3 changed files with 44 additions and 15 deletions

View File

@@ -1094,9 +1094,23 @@ class ApiKernel
$auth = $this->requireAuth();
$customerId = (int)($auth['customer_id'] ?? 0);
$defaults = $this->resolveLegacySectionDefaults($kind);
$section = $defaults['is_template']
? $this->ensureEmailtemplateSection($customerId)
: $this->ensureContentSection($customerId, $defaults['name'], $defaults['slug'], false);
if ($defaults['is_template']) {
$section = $this->ensureEmailtemplateSection($customerId);
} else {
$section = $this->fetchContentSectionBySlug($customerId, $defaults['slug']);
}
if (!$section) {
$this->respond([
'ok' => true,
'kind' => 'content',
'items' => [],
'data' => [],
'count' => 0,
'offset' => 0,
'limit' => 0,
]);
return;
}
$this->handleContentList($section);
}
@@ -1105,9 +1119,12 @@ class ApiKernel
$auth = $this->requireAuth();
$customerId = (int)($auth['customer_id'] ?? 0);
$defaults = $this->resolveLegacySectionDefaults($kind);
$section = $defaults['is_template']
? $this->ensureEmailtemplateSection($customerId)
: $this->ensureContentSection($customerId, $defaults['name'], $defaults['slug'], false);
if ($defaults['is_template']) {
$section = $this->ensureEmailtemplateSection($customerId);
} else {
$section = $this->fetchContentSectionBySlug($customerId, $defaults['slug']);
}
if (!$section) $this->fail('section not configured', ['kind' => $kind], 404);
$this->handleContentGet($section);
}
@@ -1116,9 +1133,12 @@ class ApiKernel
$auth = $this->requireAuth();
$customerId = (int)($auth['customer_id'] ?? 0);
$defaults = $this->resolveLegacySectionDefaults($kind);
$section = $defaults['is_template']
? $this->ensureEmailtemplateSection($customerId)
: $this->ensureContentSection($customerId, $defaults['name'], $defaults['slug'], false);
if ($defaults['is_template']) {
$section = $this->ensureEmailtemplateSection($customerId);
} else {
$section = $this->fetchContentSectionBySlug($customerId, $defaults['slug']);
}
if (!$section) $this->fail('section not configured', ['kind' => $kind], 404);
$this->handleContentCreate($section);
}
@@ -1127,9 +1147,12 @@ class ApiKernel
$auth = $this->requireAuth();
$customerId = (int)($auth['customer_id'] ?? 0);
$defaults = $this->resolveLegacySectionDefaults($kind);
$section = $defaults['is_template']
? $this->ensureEmailtemplateSection($customerId)
: $this->ensureContentSection($customerId, $defaults['name'], $defaults['slug'], false);
if ($defaults['is_template']) {
$section = $this->ensureEmailtemplateSection($customerId);
} else {
$section = $this->fetchContentSectionBySlug($customerId, $defaults['slug']);
}
if (!$section) $this->fail('section not configured', ['kind' => $kind], 404);
$this->handleContentUpdate($section);
}
@@ -1138,9 +1161,12 @@ class ApiKernel
$auth = $this->requireAuth();
$customerId = (int)($auth['customer_id'] ?? 0);
$defaults = $this->resolveLegacySectionDefaults($kind);
$section = $defaults['is_template']
? $this->ensureEmailtemplateSection($customerId)
: $this->ensureContentSection($customerId, $defaults['name'], $defaults['slug'], false);
if ($defaults['is_template']) {
$section = $this->ensureEmailtemplateSection($customerId);
} else {
$section = $this->fetchContentSectionBySlug($customerId, $defaults['slug']);
}
if (!$section) $this->fail('section not configured', ['kind' => $kind], 404);
$this->handleContentDelete($section);
}