StudentLoanManagement
com.student_loan.controller.LoanController Class Reference

Public Member Functions

ResponseEntity< List< Loan > > getAllLoans (@RequestParam("token") String token)
 
ResponseEntity< Loan > getLoanById (@PathVariable Long id, @RequestParam("token") String token)
 
ResponseEntity< List< Loan > > getLoansByLender ()
 
ResponseEntity< List< Loan > > getLoansByBorrower ()
 
ResponseEntity< String > createLoan (@RequestBody LoanRecord loanRecord)
 
ResponseEntity< String > updateLoan (@PathVariable Long id, @RequestBody LoanRecord loan, @RequestHeader("Authorization") String authHeader)
 
ResponseEntity< Void > returnLoan (@PathVariable Long itemId)
 
ResponseEntity< String > deleteLoan (@PathVariable Long id, @RequestParam("token") String token)
 

Detailed Description

Controller class for managing loans in the system. Handles HTTP requests related to loan operations such as creating, updating, deleting, and retrieving loans.

Definition at line 31 of file LoanController.java.

Member Function Documentation

◆ createLoan()

ResponseEntity< String > com.student_loan.controller.LoanController.createLoan ( @RequestBody LoanRecord  loanRecord)

Creates a new loan.

Parameters
loanRecordThe loan data.
Returns
ResponseEntity indicating the result of the operation.

Definition at line 138 of file LoanController.java.

◆ deleteLoan()

ResponseEntity< String > com.student_loan.controller.LoanController.deleteLoan ( @PathVariable Long  id,
@RequestParam("token") String  token 
)

Deletes a loan by its ID.

Parameters
idThe ID of the loan.
tokenThe authentication token.
Returns
ResponseEntity indicating the result of the operation.

Definition at line 228 of file LoanController.java.

◆ getAllLoans()

ResponseEntity< List< Loan > > com.student_loan.controller.LoanController.getAllLoans ( @RequestParam("token") String  token)

Retrieves all loans in the system.

Parameters
tokenThe authentication token.
Returns
ResponseEntity containing a list of all loans.

Definition at line 57 of file LoanController.java.

◆ getLoanById()

ResponseEntity< Loan > com.student_loan.controller.LoanController.getLoanById ( @PathVariable Long  id,
@RequestParam("token") String  token 
)

Retrieves a loan by its ID.

Parameters
idThe ID of the loan.
tokenThe authentication token.
Returns
ResponseEntity containing the loan.

Definition at line 73 of file LoanController.java.

◆ getLoansByBorrower()

ResponseEntity< List< Loan > > com.student_loan.controller.LoanController.getLoansByBorrower ( )

Retrieves loans by borrower ID.

Parameters
tokenThe authentication token.
borrowerIdThe ID of the borrower.
Returns
ResponseEntity containing a list of loans by the borrower.

Definition at line 120 of file LoanController.java.

◆ getLoansByLender()

ResponseEntity< List< Loan > > com.student_loan.controller.LoanController.getLoansByLender ( )

Retrieves loans by lender ID.

Parameters
tokenThe authentication token.
lenderIdThe ID of the lender.
Returns
ResponseEntity containing a list of loans by the lender.

Definition at line 98 of file LoanController.java.

◆ returnLoan()

ResponseEntity< Void > com.student_loan.controller.LoanController.returnLoan ( @PathVariable Long  itemId)

Marks a loan as returned by its item ID.

Parameters
itemIdThe ID of the item.
Returns
ResponseEntity indicating the result of the operation.

Definition at line 202 of file LoanController.java.

◆ updateLoan()

ResponseEntity< String > com.student_loan.controller.LoanController.updateLoan ( @PathVariable Long  id,
@RequestBody LoanRecord  loan,
@RequestHeader("Authorization") String  authHeader 
)

Updates a loan by its ID.

Parameters
idThe ID of the loan.
loanThe updated loan data.
authHeaderThe authorization header containing the token.
Returns
ResponseEntity indicating the result of the operation.

Definition at line 165 of file LoanController.java.


The documentation for this class was generated from the following file: