API was developed using TypeScript following the principles of Programming Oriented Object (POO), Behavior Driven Development (BDD) and using ODM Mongoose to perform the CRUD of a vehicle carrier.
Unit tests were also developed for all layers and integration tests to validate the operation of the API.
Clone the project
git clone git@github.com:lucas-da-silva/car-shop.gitEnter the project directory
cd project-car-shopUpload containers (docker-compose is required)
docker-compose up -dEnter the car_shop container
docker exec -it car_shop bashInstall the dependencies
npm installStart the server
npm run devInside the car_shop container, run the following command
npm run test POST /carsRequest body parameters:
| Parameter | Type | Description |
|---|---|---|
model |
string |
Mandatory. Vehicle model |
year |
number |
Mandatory. Year of manufacture of the vehicle |
color |
string |
Mandatory. Vehicle main color |
status |
boolean |
Optional. Vehicle may or may not be purchased |
buyValue |
number |
Mandatory. Vehicle purchase price |
doorsQty |
number |
Mandatory. Number of doors on a car |
seatsQty |
number |
Mandatory. Number of seats in a car |
GET /cars GET /cars/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. ID of the car you want |
PUT /cars/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. Car ID you want to change |
Request body parameters:
| Parameter | Type | Description |
|---|---|---|
model |
string |
Mandatory. Vehicle model |
year |
number |
Mandatory. Year of manufacture of the vehicle |
color |
string |
Mandatory. Vehicle main color |
status |
boolean |
Optional. Vehicle may or may not be purchased |
buyValue |
number |
Mandatory. Vehicle purchase price |
doorsQty |
number |
Mandatory. Number of doors on a car |
seatsQty |
number |
Mandatory. Number of seats in a car |
DELETE /cars/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. Car ID you want to delete |
POST /motorcyclesRequest body parameters:
| Parameter | Type | Description |
|---|---|---|
model |
string |
Mandatory. Vehicle model |
year |
number |
Mandatory. Year of manufacture of the vehicle |
color |
string |
Mandatory. Vehicle main color |
status |
boolean |
Optional. Vehicle may or may not be purchased |
buyValue |
number |
Mandatory. Vehicle purchase price |
category |
number |
Mandatory. Motorcycle category (options: Street, Custom or Trail) |
engineCapacity |
number |
Mandatory. Engine capacity |
GET /motorcycles GET /motorcycles/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. ID of the motorcycles you want |
PUT /motorcycle/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. Motorcycle ID you want to change |
Request body parameters:
| Parameter | Type | Description |
|---|---|---|
model |
string |
Mandatory. Vehicle model |
year |
number |
Mandatory. Year of manufacture of the vehicle |
color |
string |
Mandatory. Vehicle main color |
status |
boolean |
Optional. Vehicle may or may not be purchased |
buyValue |
number |
Mandatory. Vehicle purchase price |
category |
number |
Mandatory. Motorcycle category (options: Street, Custom or Trail) |
engineCapacity |
number |
Mandatory. Engine capacity |
DELETE /motorcycle/${id}| Parameter | Type | Description |
|---|---|---|
id |
string |
Mandatory. Motorcycle ID you want to delete |
Database: MongoDB