Class AccountHolderController
java.lang.Object
com.dada.banking_project.controllers.impl.AccountHolderController
@RestController
@RequestMapping("/api/account-holder/")
public class AccountHolderController
extends Object
The AccountHolderController class handles HTTP requests related to AccountHolder entities.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAccountHolder
(AccountHolder accountHolder) Adds a new AccountHolder to the database.Retrieves a list of all Account entities associated with a particular AccountHolder.Retrieves a list of all AccountHolder entities in the database.void
transferFunds
(TransactionDTO transactionDTO) Transfers funds between two Account entities.
-
Constructor Details
-
AccountHolderController
public AccountHolderController()
-
-
Method Details
-
addAccountHolder
@PostMapping("/new") @ResponseStatus(CREATED) public AccountHolder addAccountHolder(@RequestBody AccountHolder accountHolder) Adds a new AccountHolder to the database.- Parameters:
accountHolder
- The AccountHolder object to be added.- Returns:
- The newly created AccountHolder object.
-
findAllAccountHolder
Retrieves a list of all AccountHolder entities in the database.- Returns:
- The list of all AccountHolder entities.
-
transferFunds
@PostMapping("/transaction") @ResponseStatus(OK) public void transferFunds(@RequestBody TransactionDTO transactionDTO) Transfers funds between two Account entities.- Parameters:
transactionDTO
- The transaction details.
-
checkBalanceAccounts
@GetMapping("/check-accounts/{id}") @ResponseStatus(OK) public List<Account> checkBalanceAccounts(@PathVariable Integer id) Retrieves a list of all Account entities associated with a particular AccountHolder.- Parameters:
id
- The ID of the AccountHolder.- Returns:
- The list of Account entities associated with the AccountHolder.
-