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.
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Jobs\FetchCurrencyRates;
|
use App\Jobs\FetchCurrencyRates;
|
||||||
|
use App\Jobs\FetchGoldRates;
|
||||||
|
use App\Jobs\MergeCurrencyAndGoldRates;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class CurrencyController extends Controller
|
class CurrencyController extends Controller
|
||||||
@@ -10,12 +12,15 @@ class CurrencyController extends Controller
|
|||||||
public function getCurrentRates()
|
public function getCurrentRates()
|
||||||
{
|
{
|
||||||
// Job'ı çalıştır
|
// Job'ı çalıştır
|
||||||
// $data = FetchCurrencyRates::dispatchSync();
|
/*
|
||||||
|
FetchCurrencyRates::dispatchSync();
|
||||||
|
FetchGoldRates::dispatchSync();
|
||||||
|
MergeCurrencyAndGoldRates::dispatchSync();
|
||||||
|
*/
|
||||||
// JSON dosyasından oku
|
// JSON dosyasından oku
|
||||||
if (Storage::exists('currency/today.json')) {
|
if (Storage::exists('merged/rates.json')) {
|
||||||
return response()->json(
|
return response()->json(
|
||||||
json_decode(Storage::get('currency/today.json'), true)
|
json_decode(Storage::get('merged/rates.json'), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user