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

This commit is contained in:
2026-04-29 02:32:42 +02:00
parent 4ead35047a
commit 79872f3337
5 changed files with 159 additions and 191 deletions

View File

@@ -73,17 +73,12 @@ final class Router
if ($path === 'v1/refresh' && $method === 'POST') {
$input = $this->input();
$base = $this->stringOrNull($input['base'] ?? null);
$currencies = $this->parseCsv($input['currencies'] ?? null);
if ($currencies === null) {
$settings = module_fn('fx-rates', 'settings');
$currencies = is_array($settings['preferred_currencies'] ?? null) ? $settings['preferred_currencies'] : null;
}
$force = !empty($input['force']);
$maxAgeHours = is_numeric($input['max_age_hours'] ?? null) ? (float) $input['max_age_hours'] : 24.0;
$result = $force
? $this->service->refreshLatestRates($currencies, $base)
: $this->service->ensureFreshLatestRates($maxAgeHours, $base, $currencies);
? $this->service->refreshLatestRates(null, $base)
: $this->service->ensureFreshLatestRates($maxAgeHours, $base, null);
$this->respond(['data' => $result], 201);
}