Class AdminController
java.lang.Object
com.dada.banking_project.controllers.impl.AdminController
This class represents the REST controller for admin-related account operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAccount
(AccountDTO accountDTO) This method handles the creation of a new account.void
deleteAccount
(Integer id) This method handles the deletion of an account.This method handles the retrieval of all accounts.This method handles the retrieval of the balance for a specific account.updateAccountBalance
(Integer id, BigDecimal balance) This method handles the updating of the balance for a specific account.
-
Constructor Details
-
AdminController
public AdminController()
-
-
Method Details
-
addAccount
@PostMapping("/account/new") @ResponseStatus(CREATED) public Account addAccount(@RequestBody AccountDTO accountDTO) This method handles the creation of a new account.- Parameters:
accountDTO
- The DTO representing the new account to be created.- Returns:
- The created account.
-
findAllAccount
This method handles the retrieval of all accounts.- Returns:
- A list of all accounts.
-
getAccountBalance
@GetMapping("/account/balance/{id}") @ResponseStatus(OK) public BigDecimal getAccountBalance(@PathVariable Integer id) This method handles the retrieval of the balance for a specific account.- Parameters:
id
- The id of the account.- Returns:
- The balance of the specified account.
-
updateAccountBalance
@PutMapping("/account/update-balance/{id}") @ResponseStatus(OK) public Account updateAccountBalance(@PathVariable Integer id, @RequestParam BigDecimal balance) This method handles the updating of the balance for a specific account.- Parameters:
id
- The id of the account.balance
- The new balance value.- Returns:
- The updated account.
-
deleteAccount
@DeleteMapping("/account/delete/{id}") @ResponseStatus(NO_CONTENT) public void deleteAccount(@PathVariable Integer id) This method handles the deletion of an account.- Parameters:
id
- The id of the account to be deleted.
-