Product Managment Test
To run this project, you will need to add the following environment variables to your .env file
JWT_SECRET
: jwt secret for the firm
DB_URL
: url to the database
To deploy this project run
git add .
git commit -m "commit"
git push origin dev
create pull request to master
deploy to docker hub
Install product-management with npm
cd product-management
npm i
npm run start
Description: this endpoint is used to authenticate with the system via email and password, it will return the access token and username.
POST {{baseUrl}}/auth/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. email user |
password |
string |
Required. password user |
Description: this end point is used to create a new product and add to store.
POST {{baseUrl}}/products
Parameter | Type | Description |
---|---|---|
name |
string |
Required. name product |
price |
decimal |
Required. price product |
description |
string |
Required. description product |
storeId |
integer |
Required. Id store |
stock |
integer |
Required. stock of product |
Description: this endpoint is used to obtain all registered products.
GET {{baseUrl}}/products
Description: this endpoint is used to obtain a single product if it is registered.
GET {{baseUrl}}/products/{{productId}}
Parameter | Type | Description |
---|---|---|
productId |
integer |
Required. id product |
Description: this endpoint is used to update the data of a product.
PUT {{baseUrl}}/products/{{productId}}
Parameter | Type | Description |
---|---|---|
productId |
integer |
Required. id product |
name |
string |
Required. name product |
price |
decimal |
Required. price product |
description |
string |
Required. description product |
storeId |
integer |
Required. Id store |
stock |
integer |
Required. stock of product |
Description: this end point is used to eliminate a product.
DELETE {{baseUrl}}/products/{{productId}}
Parameter | Type | Description |
---|---|---|
productId |
integer |
Required. id product |
Description: this endpoint is used to create a new locale.
POST {{baseUrl}}/stores
Parameter | Type | Description |
---|---|---|
name |
string |
Required. name store |
address |
string |
Required. address store |
phone |
integer |
Required.phone store example: +5601235678908 |
Description: this endpoint is used to get all registered stores.
GET {{baseUrl}}/stores
Description: this endpoint is used to obtain a store if it is registered.
GET {{baseUrl}}/stores/{{storeId}}
Parameter | Type | Description |
---|---|---|
storeId |
integer |
Required. id store |
Description: this endpoint is used to update the data of a store.
PUT {{baseUrl}}/stores/{{storeId}}
Parameter | Type | Description |
---|---|---|
storeId |
integer |
Required. id store |
name |
string |
Required. name store |
address |
string |
Required. address store |
phone |
integer |
Required.phone store example: +5601235678908 |
Description: this end point is used to eliminate a store.
DELETE {{baseUrl}}/stores/{{storeId}}
Parameter | Type | Description |
---|---|---|
storeId |
integer |
Required. id store |