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:
Ümit Tunç
2025-01-21 22:50:30 +03:00
parent 41fa599cd3
commit 0ab592ecbc
+24 -9
View File
@@ -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,7 +48,9 @@ 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
*/ */
@@ -81,7 +84,9 @@ 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
*/ */
@@ -115,7 +120,9 @@ 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
*/ */
@@ -149,7 +156,9 @@ class CurrencyController extends Controller
} }
/** /**
* Retrieves the current crypto currency rates * Get current crypto rates.
* @group Crypto
* @subgroup Fetch Rates
* *
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
@@ -182,7 +191,9 @@ 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,7 +214,9 @@ 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,7 +237,9 @@ 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