To run the project, please follow the below steps:
-
Clone the project from the repository.
-
Delete the old SQL database if present on your system with the name "HomeLoan". a. Open SSMS (Microsoft SQL Server Management Studio). b. Make sure to check the checkbox for "close existing connections" while deleting the old database.
-
Go to the package manager console in Visual Studio.
-
Select "DataAccess" as default.
-
Run the following command:
Add-Migration init
. -
Run the following command:
Update-Database
. -
Start the project.
-
Swagger will launch, and you can access the API endpoints.
If you face any issues while running the project, please reach out to the development team for assistance.
The api uses jwt token based authentication with token expiration time of 5 hours. There can be users of 2 types either Advisor or User. By default creating / registering a user from APIs will create a user of Type User. The System contains one pre registered Advisor having credentials email : Advisor1@email.com & password : "Abcd@1234"
Diffrent API endpoints require diffrent levels of Authorization
Anyone can signup without any restrictions
Anyone can signin using email and password without any restrictions
Either User or Advisor can cange their password using their old password after signin
User can get all of his collaterals after signin
User can create a new collateral after signin
User can modify a collateral after signin
User can delete a collateral after signin
User can create a new loan after signin
User can see all his loans after signin
User can apply a specific loan using loanId after signin
User can edit a loan if its in created state using its loanId after signin
User can get a loan using loan id after signin
Advisor can get all of users loan after signin
User can add a collateral to loan using loanId and coillateralId after signin
User can get all collaterals in a loan after signin
User can delete or remove a collateral from a loan using loanId and CollateralId after signin
Advisor can change the state of the loan after signin.
Advisor can change the loan application state from:
- Rejected to (In progress)
- Recommented to (Rejected, In Progress)
- In Progress to (Accepted, Rejected, Recommended)
Anyone can get the current active promotion
Advisor can add new Promotions.
Anyone can get the list of all countries.
Advisor can add a country
Anyone can get a country by its id
Advisor can Edit a country
Advisor can delete a country
Anyone can get the list of all states in a country.
Advisor can add a state in a country
Anyone can get a state by its id
Advisor can Edit a state
Advisor can delete a state
Anyone can get the list of all cities in a state.
Advisor can add a city in a state
Anyone can get a city by its id
Advisor can Edit a city
Advisor can delete a city
The Api uses enums for constants so the requests require correct mapped integer for it to work. Here is a list of all the Enums.
Collateral Types | |
---|---|
Insurance_Policy | 0 |
Gold | 1 |
Stock | 2 |
Property | 3 |
Loan State | |
---|---|
Created | 0 |
InProgress | 1 |
Accepted | 2 |
Rejected | 3 |
Recommended | 4 |
LoanStatus | |
---|---|
RED | 0 |
YELLOW | 1 |
GREEN | 2 |
PromotionTypes | |
---|---|
A | 0 |
B | 1 |
C | 2 |
Collateral Conversion Value | |
---|---|
Insurance_Policy | 80% |
Gold | 75% |
Stock | 50% |
Property | 80% |
LoanStatus Value | |
---|---|
RED | <= 40% |
YELLOW | <= 70% |
GREEN | > 70% |