You can continue working on the code from last week for this weeks task.
To submit you should open a pull request with all of your code in this folder.
In the following homework, you will create new API endpoints in the NodeJS application cyf-ecommerce-api that you created for last week's homework for the Database 2 class.
-
If you don't have it already, add a new GET endpoint
/productsto load all the product names along with their prices and supplier names. -
Update the previous GET endpoint
/productsto filter the list of products by name using a query parameter, for example/products?name=Cup. This endpoint should still work even if you don't use thenamequery parameter! -
Add a new GET endpoint
/customers/:customerIdto load a single customer by ID. -
Add a new POST endpoint
/customersto create a new customer with name, address, city and country. -
Add a new POST endpoint
/productsto create a new product. -
Add a new POST endpoint
/availabilityto create a new product availability (with a price and a supplier id). Check that the price is a positive integer and that both the product and supplier ID's exist in the database, otherwise return an error. -
Add a new POST endpoint
/customers/:customerId/ordersto create a new order (including an order date, and an order reference) for a customer. Check that the customerId corresponds to an existing customer or return an error. -
Add a new PUT endpoint
/customers/:customerIdto update an existing customer (name, address, city and country). -
Add a new DELETE endpoint
/orders/:orderIdto delete an existing order along with all the associated order items. -
Add a new DELETE endpoint
/customers/:customerIdto delete an existing customer only if this customer doesn't have orders. -
Add a new GET endpoint
/customers/:customerId/ordersto load all the orders along with the items in the orders of a specific customer. Especially, the following information should be returned: order references, order dates, product names, unit prices, suppliers and quantities.