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
+25 -10
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.
* @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,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
*/
@@ -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
*/
@@ -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
*/
@@ -145,11 +152,13 @@ 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
*/
@@ -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
* @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
* @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
* @return \Illuminate\Http\JsonResponse