Refactor CurrencyController to enhance API documentation and response messages
- Updated method documentation to clearly describe the fetching of currency, crypto, and gold rates. - Improved response messages to include all relevant rates (currency, crypto, and gold) for better clarity. - Added grouping and subgroup annotations to API methods for improved organization in documentation. - Enhanced consistency in method descriptions across the controller. These changes collectively improve the clarity and usability of the CurrencyController in the Truncgil Finance application.
This commit is contained in:
@@ -20,8 +20,9 @@ class CurrencyController extends Controller
|
||||
|
||||
|
||||
/**
|
||||
* ⚙️ Dispatches all jobs to fetch currency and gold rates synchronously.
|
||||
* Synchronously fetch all currency, crypto and gold rates.
|
||||
* Rate limited to 2 requests per 30 seconds.
|
||||
* @group Cron Job
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -36,7 +37,7 @@ class CurrencyController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'All currency and gold rates have been successfully updated'
|
||||
'message' => 'All currency, crypto and gold rates have been successfully updated'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
@@ -47,8 +48,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 🪙 💵 ₿ Retrieves all gold and currency rates
|
||||
*
|
||||
* Get all currency, crypto and gold rates.
|
||||
* @group All Rates
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getAllRates()
|
||||
@@ -81,8 +84,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 💵 Retrieves the current currency rates
|
||||
*
|
||||
* Get current currency rates.
|
||||
* @group 💵 Currency
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getCurrentRates()
|
||||
@@ -115,8 +120,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 🪙 Retrieves the current gold rates
|
||||
*
|
||||
* Get current gold rates.
|
||||
* @group 🪙 Gold
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getGoldRates()
|
||||
@@ -145,12 +152,14 @@ class CurrencyController extends Controller
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
return response()->json(['error' => 'Data not found'], 404);
|
||||
return response()->json(['error' => 'Data not found'], 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* ₿ Retrieves the current crypto currency rates
|
||||
*
|
||||
* Get current crypto rates.
|
||||
* @group ₿ Crypto
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getCryptoCurrencyRates()
|
||||
@@ -182,8 +191,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 🟰 💵 Retrieves the currency rate by its name
|
||||
*
|
||||
* Get currency rate by name.
|
||||
* @group 💵 Currency
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @param string $currencyName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -203,8 +214,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 🟰 🪙 Retrieves the gold rate by its name
|
||||
*
|
||||
* Get gold rate by name.
|
||||
* @group 🪙 Gold
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @param string $goldName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
@@ -224,8 +237,10 @@ class CurrencyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 🟰 ₿ Retrieves the crypto currency rate by its name
|
||||
*
|
||||
* Get crypto rate by name.
|
||||
* @group ₿ Crypto
|
||||
* @subgroup Fetch Rates
|
||||
*
|
||||
* @param string $cryptoCurrencyName
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user