chicken-sloths / bangazon-api-sprint1

API for a mock Amazon + Etsy platform providing developers access to the company's employee & product data
0 stars 0 forks source link

Got all of the verbs working for Customers. There are 3 GETs, a Post,… #101

Closed joechesney closed 6 years ago

joechesney commented 6 years ago

… and a PUT

Description

Got all of the verbs working for Customers. There are 3 GETs, a Post, and a Put.

Number of Fixes

Fixes #1

Related Ticket(s)

1

Problem to Solve

Gives users access to the Customers Table

Expected Behavior

Should correctly Get all customers, or Get a single customer, or Get all customers that have not placed an order, or Post a new customer to the Customers table, or Put new property values onto an existing customer.

Steps to Test Solution

  1. To test the GET allCustomers function, go to http://127.0.0.1:8080/api/v1/customers and there should be all of the customers listed, which I believe is 25 total customers.
  2. To test the GET oneCustomer function, go to http://127.0.0.1:8080/api/v1/customers/15 (or replace the number 15 in the url with any number between 0 and 24, and there should be one customer listed, and their customer_id should match the number you typed into the url.
  3. ALSO go to routes/customers/index.js and make sure the route for customers look s like this: productsIndexRouter.use("/customers", require('./customers'));
  4. THEN go to routes/products/customers.js and make sure the routes look like this: customersRouter.get('/:id', getOneCustomer);

customersRouter.put('/:id', updateCustomer);

customersRouter.get('/', getAllCustomers);

customersRouter.post('/', postNewCustomer);

Testing

[ ] There are new unit tests in this PR, and I verify that there is full coverage of all new code. [ ] I certify that all existing tests pass

Documentation

[] There is new documentation in this pull request that must be reviewed.. [ ] I added documentation for any new classes/methods

jordan-castelloe commented 6 years ago

Also, for the next person who tests this branch, here's the JSON I used for POST and PUT so you don't have to write it again. { "first_name": "Nicolas", "last_name": "Cage", "account_creation_date": "2018-03-22T15:52:23.254Z", "street_address": "123 Awesome Street", "city": "Crab Apple", "state": "North Carolina", "postal_code": "100000", "phone_number": "(042) 494-3771 x385" }

jordan-castelloe commented 6 years ago

Also, @joechesney: it looks like you checked a box that there's new documentation in this pr that I should review, but I wasn't sure where to look. Happy to look at it, just point me in the right direction!

DavidLarsKetch commented 6 years ago

Don't forget to test http://localhost:8080/api/v1/customers?active=false!

kenziebottoms commented 6 years ago

testing