Conversation
create user and community features
Get communities associated with a given userId
User and community feature
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 9696177 | Triggered | Username Password | 1c8facd | src/main/resources/application.properties | View secret |
| 9696177 | Triggered | Username Password | 07d5635 | src/main/resources/application.properties | View secret |
| 9696177 | Triggered | Username Password | 08919bf | src/main/resources/application.properties | View secret |
| 9696177 | Triggered | Username Password | 6b99b8f | src/main/resources/application.properties | View secret |
| 9696177 | Triggered | Username Password | faf9a17 | src/main/resources/application.properties | View secret |
| 9696177 | Triggered | Username Password | 8930a4d | src/main/resources/application.properties | View secret |
| 9696178 | Triggered | Generic Password | 08919bf | src/main/java/com/educare/unitylend/dao/UserRepository.java | View secret |
| 9696178 | Triggered | Generic Password | 046509a | src/main/java/com/educare/unitylend/dao/UserRepository.java | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
| @Mapper | ||
| @Repository | ||
| public interface BorrowRequestRepository { | ||
|
|
There was a problem hiding this comment.
- Add method to fetch borrow request based on community_id, This is required for lenders page.
- Modify the schema to have a borrow request multiple communities, You can have a separate table which can have the mapping of community to Borrow request.
| @@ -12,12 +10,27 @@ | |||
| @NoArgsConstructor | |||
| @AllArgsConstructor | |||
| public class BorrowRequest { | |||
| "FROM Borrow_Request " + | ||
| "JOIN Community ON Borrow_Request.CommunityID = Community.CommunityId " + | ||
| "WHERE Borrow_Request.BorrowerId = #{userId}") | ||
| List<String> getBorrowRequestByUserId(@Param("userId") String userId); |
There was a problem hiding this comment.
Based on the functionality, The function name should be
getCommunitiesForWhichBorrowRequestRaisedByUser()
|
|
||
| public interface BorrowRequestService { | ||
|
|
||
| List<String> getRequestedCommunitiesByUserId(String userId) throws ServiceException; |
There was a problem hiding this comment.
The function name should be
getCommunitiesForBorrowrequestRaisedByUser()
|
|
||
| List<String> getRequestedCommunitiesByUserId(String userId) throws ServiceException; | ||
|
|
||
| boolean raiseBorrowRequestByUserId(String userId, BorrowRequest borrowRequest) throws ServiceException; |
There was a problem hiding this comment.
- The function name should be
validateBorrowRequest. - I don't think that there is any need to pass userId as
BorrowRequestobject would already be having the borrower details.
|
|
||
| boolean raiseBorrowRequestByUserId(String userId, BorrowRequest borrowRequest) throws ServiceException; | ||
|
|
||
| void createBorrowRequest(BorrowRequest borrowRequest) throws ServiceException; |
There was a problem hiding this comment.
This function should also return boolean value, Whether the borrow request is created successfully in the DB or not.
| private BorrowRequestRepository borrowRequestRepository; | ||
| public List<String> getRequestedCommunitiesByUserId(String userId) throws ServiceException{ | ||
| List<String> communities=borrowRequestRepository.getBorrowRequestByUserId(userId); | ||
| System.out.println(communities); |
There was a problem hiding this comment.
Do not use System.out.println instead use log.error, log.info or log.debug
| } | ||
|
|
||
| public void createBorrowRequest(BorrowRequest borrowRequest) { | ||
| borrowRequestRepository.createBorrowRequest(borrowRequest); |
There was a problem hiding this comment.
You should have a try catch block,
If any error is encountered, Return false.
| public boolean raiseBorrowRequestByUserId(String userId, BorrowRequest borrowRequest) throws ServiceException { | ||
| try { | ||
| // Assuming returnPeriod is in days | ||
| BigDecimal monthlyInterestRate = new BigDecimal("50.0").divide(new BigDecimal(12 * 100), 10, RoundingMode.HALF_UP); |
There was a problem hiding this comment.
- Move all the constants used to the start of the class, i.e
public static final Integer MONTHS_IN_YEAR = 12. - Add interest_rate in the BorrowRequest Object
- Add loan tenure in BorrowRequest object.
- The validation method here should just calculate the monthly EMI and then validate based on the user income if the user will be able to pay the amount or not, By checking if the user income is double of the EMI or not.
There was a problem hiding this comment.
And for calculating the EMI you should have different function calculateEMI(PrincipalAmount, loanPaymentTenure, InterestRate) and this function should utilize that.
| public class BorrowRequestController extends BaseController{ | ||
| BorrowRequestService borrowRequestService; | ||
| @GetMapping("/{userId}") | ||
| public ResponseEntity<List<String>> getAllCommunities(@PathVariable String userId) throws ControllerException { |
There was a problem hiding this comment.
The function name should be getCommunitiesForUser()
There was a problem hiding this comment.
There should be a method for getting the borrowRequest for a given UserId, Community.
And one for Administration purpose to get all the Borrowrequests.
Implemented the following features:
-Have a separate table for borrowing request with all the attributes of borrowing and map with the user table with foreign key
-Validation should be there at service layer for borrow request (i.e - The monthly emi should not be more than half of the monthly income of borrower)
-If a borrowing request is not passing the validations, Return the error message to the UI.
-If borrowing request is validated, Return the success message to the user and insert into DB.
-Think how the mapping of community to borrowing request will happen (User to borrowing request or Community to borrowing request)