cmsamaaa / datwyler-assessment-2022

Datwyler IT Assessment 2022 - Full Stack Software Developer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

datwyler-assessment-2022

Datwyler IT Infra Assessment 2022 - Full Stack Software Developer

This project is written in Node.js with TypeScript, using Angular.js framework for the frontend, with Java Spring Boot framework for the backend, and SQLite for lightweight database storage due to the small scale of the project.

The frontend app will run on http://localhost:4200 and backend app on http://localhost:8080. Please ensure that these two ports are free.

Instructions on how to log in the app can be found here.

Author: Loh Chun Mun

Table of Contents

Pre-requisites

Node.js

As the frontend is built with Angular.js, you must have Node.js installed on your device to be able to run it. A quick way to get started is to directly install Node.js on your system. You may download the installer here.

However, it is strongly recommended to use a Node version manager such as nvm to install Node.js and npm. You may read more about it here.

Java JDK 17

The backend is built with Java Spring Boot with Java 17, hence it is necessary to install the JDK on your device so that you can start the Spring Boot application without compatibility issues.

You may download it here.

Setup Guide (Local)

If this is your first time running this project, you will be required to install the Node dependencies for the frontend Angular.js project.

You may can enter npm ci into the terminal in ./frontend folder. This will step will install all necessary dependencies based on the ./frontend/package-lock.json. This process may take awhile.

To simplify this step, you may run the following batch script:

.\setup-npm.bat

For Windows only

A batch script has been created for your convenience in starting up both the frontend and backend application.

.\run.bat

NOTE: Amend the JAVA_HOME in this batch script to the Java JDK 17 directory on your device.

Alternatively, you may start the frontend app by entering npm start into the terminal from ./frontend folder, and entering mvnw spring-boot:run into the terminal from ./backend folder.

Login Information

For demonstration purposes, any combination of username and password can be used to access the banking system. However, empty username and password fields are not allowed.

API Documentation

This API supports JSON format. Please ensure request body is in a Content-Type: application/json format.

1. Create Credit Facility

POST /create/creditFacility

Request Body:

{
    "applicantId": Integer
}
Parameter Type Description
applicantId Integer Required. Applicant object ID.

Responses:

// Valid Request Response
true
// Invalid Request Response
false

2. Create Loan

POST /create/loan

Request Body:

{
    "amount": Double,
    "type": String,
    "creditId": Integer
}
Parameter Type Description
amount Double or Decimal Required. Loan amount.
type String Required. Loan type: Home or Car
creditId Integer Required. Credit facility object ID.

Responses:

// Valid Request Response
true
// Invalid Request Response
false

3. Get All Loans By Applicant

GET /get/loan/all/:applicantId
Parameter Type Description
:applicantId Integer Required. To retrieve all loans made by an applicant based on the applicantId.

Responses:

// Valid Request Response
[
    {
        loanId: Integer,
        amount: Double,
        type: String,
        status: String,
        creditId: Integer,
    },
    ...
];
// Invalid Request Response
null

4. Get All Applicants

GET /get/applicant/all

Responses:

// Valid Request Response
[
    {
        "applicantId": Integer,
        "nric": String,
        "firstName": String,
        "lastName": String
    },
    ...
];
// Invalid Request Response
null

5. Get List of Credit Facilities

GET /get/credit-facility/all

Responses:

// Valid Request Response
[
    {
        "creditId": Integer,
        "applicantId": Integer,
        "applicant": {
            "applicantId": Integer,
            "nric": String,
            "firstName": String,
            "lastName": String
        }
    },
    ...
];
// Invalid Request Response
null

Cross-Origin Resource Sharing (CORS)

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.

By default, the frontend app do not have access toi the API endpoints, thus CORS is granted on the backend app for the frontend host and port of http://localhost:4200.

About

Datwyler IT Assessment 2022 - Full Stack Software Developer


Languages

Language:TypeScript 53.6%Language:HTML 21.2%Language:Java 19.4%Language:JavaScript 2.7%Language:CSS 2.3%Language:Batchfile 0.8%