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.
|
* Rate limited to 2 requests per 30 seconds.
|
||||||
|
* @group Cron Job
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -36,7 +37,7 @@ class CurrencyController extends Controller
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'success',
|
'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) {
|
} catch (\Exception $e) {
|
||||||
return response()->json([
|
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
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getAllRates()
|
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
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getCurrentRates()
|
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
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getGoldRates()
|
public function getGoldRates()
|
||||||
@@ -145,12 +152,14 @@ class CurrencyController extends Controller
|
|||||||
return response()->json($data);
|
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
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
public function getCryptoCurrencyRates()
|
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
|
* @param string $currencyName
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @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
|
* @param string $goldName
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @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
|
* @param string $cryptoCurrencyName
|
||||||
* @return \Illuminate\Http\JsonResponse
|
* @return \Illuminate\Http\JsonResponse
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user