Tools and Technologies: Java8, Spring Boot, MySQL, Maven, IntelliJ IDEA, REST API, Postman, JUnit, Mockito.
Project uses an in-memory database MySQL which gets populated at startup with data.
REST API is secured with HTTP Basic Authentication. The existing roles are listed below with the corresponding percompanies:
- Content Manager — administrator able to manage comanies and products
login: Manager
password: Manager
- Customer — able to search and order products
login: Customer
password: Customer
Layer | Source |
---|---|
JavaBean domain | domain folder |
Repositories | repository folder |
Services | service folder |
REST API Controllers | controller folder |
Security Configuration | security folder |
Tests | tetst controllers |
URL: http://localhost:8080/api/companies
HTTP-method: POST
Data:
- Unique company name
- Company type — a type the company. Possible types are: TYPE1, TYPE2, TYPE3
RequestBody:
{
"name": "company6-3",
"companyType": "TYPE3"
}
URL: http://localhost:8080/api/companies/6
HTTP-method: PUT
Data:
- Unique company name
- Company type — a type the company. Possible types are: TYPE1, TYPE2, TYPE3
RequestBody:
{
"name": "UpdateCompany6-1",
"companyType": "TYPE1"
}
URL: http://localhost:8080/api/companies/name/UpdateCompany6-1
HTTP-method: PUT
Data:
- Unique company name
- Company type — a type the company. Possible types are: TYPE1, TYPE2, TYPE3
RequestBody:
{
"name": "UpdateCompany2-2",
"companyType": "TYPE2"
}
URL: http://localhost:8080/api/companies/2
HTTP-method: GET
URL: http://localhost:8080/api/companies/name/comp
HTTP-method: GET
URL: http://localhost:8080/api/companies/6
HTTP-method: DELETE
URL: http://localhost:8080/api/companies/name/UpdateCompany6-1
HTTP-method: DELETE
URL: http://localhost:8080/api/products
HTTP-method: POST
Data:
- Company name
- Product name
- Product created date— the date when the product was made (UTC)
- Price – the price of the product
RequestBody:
{
"name": "product7",
"createdDate": "2019-12-05T06:50:08Z",
"price": 20.5,
"company": {
"name": "company4-3"
}
}
URL: http://localhost:8080/api/products/7
HTTP-method: DELETE
URL: http://localhost:8080/api/products/search-by-name/product
HTTP-method: GET
URL: http://localhost:8080/api/products/search-by-company-name/company2-2
HTTP-method: GET
URL: http://localhost:8080/api/products/search-by-company-type/TYPE2
HTTP-method: GET
URL: http://localhost:8080/api/products/search-before-date?date=2018-12-03T10:15:30.00Z
HTTP-method: GET
URL: http://localhost:8080/api/products/search-after-date?date=2018-12-03T10:15:30.00Z
HTTP-method: GET
HTTP-method: GET
URL: http://localhost:8080/api/products/order
HTTP-method: POST
RequestBody:
[{"id":2},
{"id": 4}]
Another RequestBody: any result of search for example:
URL: http://localhost:8080/api/products/search-by-company-name/company
HTTP-method: GET
URL: http://localhost:8080/api/products/order/history
HTTP-method: GET
URL: http://localhost:8080/api/products/order/history-of-the-most-ordered-products
HTTP-method: GET
URL: http://localhost:8080/api/products/order/history-of-the-most-ordered-companies
HTTP-method: GET