Neue Durchführungen im Märkte-Drawer anlegen

This commit is contained in:
gitea_admin committed 2026-09-19 19:49:30 +02:00
1 parent e188f932f4
commit 6fae2de15f
3 files changed
+36 -1

No files matched your search

+17
View File
@@ -34,6 +34,15 @@ if ($requestMethod === 'POST') {
exit;
}
try {
if (($payload['action'] ?? '') === 'create') {
$fields = is_array($payload['fields'] ?? null) ? $payload['fields'] : [];
$occurrence = market_management_create_occurrence($pdo, [
'market_definition_id' => $fields['market_definition_id'] ?? null,
'days' => [['date' => $fields['date'] ?? null]],
]);
echo json_encode(['ok' => true, 'occurrence_id' => (int) $occurrence['id']], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
exit;
}
$scope = (string) ($payload['scope'] ?? '');
$id = market_management_require_positive_id($payload['id'] ?? null, 'id');
$fields = is_array($payload['fields'] ?? null) ? $payload['fields'] : [];
@@ -114,6 +123,14 @@ if ($requestMethod === 'POST') {
}
}
if (($requestMethod === 'GET') && ($_GET['action'] ?? '') === 'create_options') {
echo json_encode([
'ok' => true,
'market_definitions' => market_management_list_active_market_definitions($pdo),
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
exit;
}
$occurrenceId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if (!is_int($occurrenceId) || $occurrenceId <= 0) {
http_response_code(400);