Package api.mpba.rastvdmy.controller
Class BankIdentityController
java.lang.Object
api.mpba.rastvdmy.controller.BankIdentityController
@RestController
@PreAuthorize("hasRole(\'ROLE_DEFAULT\')")
@RequestMapping(path="/api/v1/banks")
public class BankIdentityController
extends Object
Controller for managing bank identities.
This controller provides endpoints for users to interact with bank identities,
including retrieving bank information, adding new banks, and deleting bank identities.
It utilizes the BankIdentityService
for business logic and BankIdentityMapper
for mapping between request and response objects.
-
Constructor Summary
ConstructorDescriptionBankIdentityController
(BankIdentityService identityService, BankIdentityMapper identityMapper) Constructor for BankIdentityController. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<BankIdentityResponse> addBank
(jakarta.servlet.http.HttpServletRequest request, @Valid BankIdentityRequest identityRequest) Adds a new bank identity.org.springframework.http.ResponseEntity
<Void> deleteBank
(jakarta.servlet.http.HttpServletRequest request, String bankName) Deletes a bank identity by its name.org.springframework.http.ResponseEntity
<BankIdentityResponse> getBankByName
(jakarta.servlet.http.HttpServletRequest request, String name) Retrieves a specific bank identity by its name.org.springframework.http.ResponseEntity
<List<BankIdentityResponse>> getBanks
(jakarta.servlet.http.HttpServletRequest request) Retrieves all bank identities.
-
Constructor Details
-
BankIdentityController
public BankIdentityController(BankIdentityService identityService, BankIdentityMapper identityMapper) Constructor for BankIdentityController.- Parameters:
identityService
- TheBankIdentityService
to be used.identityMapper
- TheBankIdentityMapper
to be used.
-
-
Method Details
-
getBanks
@GetMapping(produces="application/json") public org.springframework.http.ResponseEntity<List<BankIdentityResponse>> getBanks(jakarta.servlet.http.HttpServletRequest request) Retrieves all bank identities.- Parameters:
request
- The HTTP servlet request containing user information.- Returns:
- A
ResponseEntity
containing a list ofBankIdentityResponse
.
-
getBankByName
@GetMapping(path="/{name}", produces="application/json") public org.springframework.http.ResponseEntity<BankIdentityResponse> getBankByName(jakarta.servlet.http.HttpServletRequest request, @PathVariable("name") String name) Retrieves a specific bank identity by its name.- Parameters:
request
- The HTTP servlet request containing user information.name
- The name of the bank to retrieve.- Returns:
- A
ResponseEntity
containing the requestedBankIdentityResponse
.
-
addBank
@PostMapping(consumes="application/json", produces="application/json") public org.springframework.http.ResponseEntity<BankIdentityResponse> addBank(jakarta.servlet.http.HttpServletRequest request, @Valid @RequestBody @Valid BankIdentityRequest identityRequest) throws Exception Adds a new bank identity.- Parameters:
request
- The HTTP servlet request containing user information.identityRequest
- The request body containing bank identity details.- Returns:
- A
ResponseEntity
containing the createdBankIdentityResponse
. - Throws:
Exception
- If there is an error while adding the bank identity.
-
deleteBank
@DeleteMapping(path="/{name}") public org.springframework.http.ResponseEntity<Void> deleteBank(jakarta.servlet.http.HttpServletRequest request, @PathVariable("name") String bankName) Deletes a bank identity by its name.- Parameters:
request
- The HTTP servlet request containing user information.bankName
- The name of the bank to delete.- Returns:
- A
ResponseEntity
with no content.
-