GoStack is an 8-week Bootcamp from RocketSeat that is mainly focused on teaching NodeJS, ReactJS, React-Native and Typescript
- Challenge description: https://git.io/JJSUI
- Test Results on
Jest_results.png
-
Post / costumers
route will receive the user'semail
andname
, returning this new user at the end.- If a client with the same
email
already exists throw an error -
customers
table on the db must havename
,email
,created_at
andupdate_at
- If a client with the same
-
Post / products
route will receive the user'sname
,price
andquantity
- If a product with the same
name
already exists throw an error -
products
table on the db must havename
,price
,quantity
,created_at
andupdate_at
- To add
price
to the db use thetype
asdecimal
, also passing the propertiesprecision
andscale
- To add
- If a product with the same
-
Post / orders
route will receivecostumer_id
and an array of products, containing theid
and thequantity
you want to add to a new order- Add to the
order
table a new order related to thecostumer_id
, while also containing the fieldscreated_at
andupdated_at
- Inside the
orders_products
table store theproduct_id
,order_id
,price
,quantity
,created_at
andupdated_at
- Create a relationship N:N between
orders
andproducts
- Create a relationship N:N between
- Add to the
-
GET /orders/:id
route returns info about a specificorder