yxcyc
All checks were successful
Deploy / deploy-staging (push) Successful in 7s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-05-04 22:22:55 +02:00
parent a9fefa7779
commit 002d450deb
4 changed files with 120 additions and 11 deletions

View File

@@ -181,6 +181,11 @@ final class Router
Http::json(['data' => $this->createMeasurement($projectKey, Http::input())], 201);
}
if (preg_match('~^measurements/(\d+)$~', $resource, $matches) && $method === 'DELETE') {
$this->deleteMeasurement($projectKey, (int) $matches[1]);
Http::json(['data' => ['deleted' => true]]);
}
if ($resource === 'measurements-import' && $method === 'POST') {
$this->repository()->ensureProject($projectKey);
Http::json(['data' => $this->importMeasurements($projectKey, Http::input())], 201);
@@ -1454,6 +1459,15 @@ final class Router
];
}
private function deleteMeasurement(string $projectKey, int $measurementId): void
{
if ($measurementId <= 0) {
throw new ApiException('measurement_id ist ungueltig.', 422);
}
$this->repository()->deleteMeasurement($projectKey, $measurementId);
}
private function syncCurrencyCatalogForMeasurement(array $payload): void
{
$priceCurrency = strtoupper(trim((string) ($payload['price_currency'] ?? '')));