Class AdminController

java.lang.Object
com.dada.banking_project.controllers.impl.AdminController

@RestController @RequestMapping("/api/admin") public class AdminController extends Object
This class represents the REST controller for admin-related account operations.
  • 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

      @GetMapping("/account-all") @ResponseStatus(OK) public List<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.