Package api.mpba.rastvdmy.controller
Class CurrencyDataController
java.lang.Object
api.mpba.rastvdmy.controller.CurrencyDataController
@RestController
@PreAuthorize("hasAnyRole(\'ROLE_DEFAULT\', \'ROLE_ADMIN\')")
@RequestMapping("/api/v1/currency-data")
public class CurrencyDataController
extends Object
Controller for managing currency data.
This controller provides endpoints for users to retrieve and update currency exchange rates.
It uses the CurrencyDataService
for business logic and CurrencyDataMapper
for mapping between
request and response objects.
-
Constructor Summary
ConstructorDescriptionCurrencyDataController
(CurrencyDataService currencyDataService, CurrencyDataMapper currencyDataMapper) Constructor for CurrencyDataController. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<CurrencyDataResponse> findByCurrency
(jakarta.servlet.http.HttpServletRequest request, String currencyType) Retrieves currency data by currency type.org.springframework.http.ResponseEntity
<List<CurrencyDataResponse>> updateAndFetchAllCurrencies
(jakarta.servlet.http.HttpServletRequest request) Updates and retrieves all currency data.
-
Constructor Details
-
CurrencyDataController
public CurrencyDataController(CurrencyDataService currencyDataService, CurrencyDataMapper currencyDataMapper) Constructor for CurrencyDataController.- Parameters:
currencyDataService
- TheCurrencyDataService
to be used.currencyDataMapper
- TheCurrencyDataMapper
to be used.
-
-
Method Details
-
updateAndFetchAllCurrencies
@GetMapping(produces="application/json") public org.springframework.http.ResponseEntity<List<CurrencyDataResponse>> updateAndFetchAllCurrencies(jakarta.servlet.http.HttpServletRequest request) Updates and retrieves all currency data.- Parameters:
request
- The HTTP servlet request containing user information.- Returns:
- A
ResponseEntity
containing a list ofCurrencyDataResponse
.
-
findByCurrency
@GetMapping(path="/{currency}", produces="application/json") public org.springframework.http.ResponseEntity<CurrencyDataResponse> findByCurrency(jakarta.servlet.http.HttpServletRequest request, @PathVariable("currency") String currencyType) Retrieves currency data by currency type.- Parameters:
request
- The HTTP servlet request containing user information.currencyType
- The type of currency to retrieve.- Returns:
- A
ResponseEntity
containing the requestedCurrencyDataResponse
.
-