From aa03ed3706923afb02fbe4978d33a795280eaa24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 17 Jan 2025 22:59:11 +0300 Subject: [PATCH] Integrate FetchGoldRates and MergeCurrencyAndGoldRates jobs in CurrencyController - Added the `FetchGoldRates` job to retrieve gold rates and the `MergeCurrencyAndGoldRates` job to combine currency and gold rates. - Updated the `getCurrentRates` method to read from a new JSON file `merged/rates.json` instead of the previous `currency/today.json`. - Commented out the synchronous dispatch of the fetching jobs for future implementation. This commit enhances the CurrencyController's functionality by preparing it for integrated financial data management. --- app/Http/Controllers/CurrencyController.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 05bb80c..b34bd83 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers; use App\Jobs\FetchCurrencyRates; +use App\Jobs\FetchGoldRates; +use App\Jobs\MergeCurrencyAndGoldRates; use Illuminate\Support\Facades\Storage; class CurrencyController extends Controller @@ -10,12 +12,15 @@ class CurrencyController extends Controller public function getCurrentRates() { // Job'ı çalıştır - // $data = FetchCurrencyRates::dispatchSync(); - + /* + FetchCurrencyRates::dispatchSync(); + FetchGoldRates::dispatchSync(); + MergeCurrencyAndGoldRates::dispatchSync(); + */ // JSON dosyasından oku - if (Storage::exists('currency/today.json')) { + if (Storage::exists('merged/rates.json')) { return response()->json( - json_decode(Storage::get('currency/today.json'), true) + json_decode(Storage::get('merged/rates.json'), true) ); }