Skip to content

Conversation

@tvojnar
Copy link

@tvojnar tvojnar commented Nov 8, 2017

Video Store API

Congratulations! You're submitting your assignment!
If you didn't get to the functionality the question is asking about, reply with what you would have done if you had completed it.

Comprehension Questions

Question Answer
Explain how you came up with the design of your ERD, based on the seed data. From the seed data we saw that there would be at least two models, one for movies and one for customers. Looking at the additional API calls we needed to be able to respond to we then realized that we needed a join table, since a movie can have many customers and a customer can have many rentals.
Describe a set of positive and negative test cases you implemented for a model. We tested validations that a new instance of customer could be created when a name was provided, but could not be created if no name was provided.
Describe a set of positive and negative test cases you implemented for a controller. We tested that an API response would be sent from the show action in the movies controller if the movie requested existed, and that the controller action would respond with not_found if the movie requested was not in the database.
How does your API respond when bad data is sent to it? As discribed above, when a movie is requested that does not exist in the database the API returns '{nothing: true}' with a status of not_found. The same thing happens if a user tries to checkin a rental that does not exist in the database. Additionally, if a user tries to make an API call to check out a movie without providing a customer_id and a movie_id then the status will be bad_request and the API will pass back a hash with the error messages from rental.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. We have a method called 'movies_checked_out_count' in our Customer model. This method returns the number of movies that a customer currently has checked out. We decided to make this a method because having this data stored in the database would mean that we were duplicating data in the database.
Do you have any recommendations on how we could improve this project for the next cohort? No, we really enjoyed this project. It was great to have it structured in a way that wasn't extra stressful because we had a short week.
Link to Trello https://trello.com/b/yKx591rL/videostoreapi
Link to ERD https://drive.google.com/file/d/1Uy1O7dd8h-ffi0PF8t2DUe0C48zyl3R6/view?usp=sharing

tvojnar and others added 30 commits November 6, 2017 12:28
added tests for customer model validations
… this migration since we don't actually want this column
…to add searializer to make sure it is working as expected
sairagula and others added 20 commits November 7, 2017 11:57
…for customers and movies. Now my tests are passing because rails can use that relationship to run the availible_inventory and movies_checked_out_count methods
added some comments to models and controllers
@PilgrimMemoirs
Copy link

Video Store

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Well Done
Comprehension questions Well Done
General
Business Logic in Models Well Done
All 3 required endpoints return expected JSON data Well done
Requests respond with appropriate HTTP Status Code Well Done
Errors are reported Well Done
Testing
Passes all Smoke Tests Well Done
Model Tests - all relations, validations, and custom functions test positive & negative cases Well Done
Controller Tests - URI parameters and data in the request body have positive & negative cases Well Done
Optionals
POST routes use URI parameter and request body to add a new record to the database Well Done - with data in body as JSON
GET /customers shows how many movies are checked out by a customer Well Done
GET /movies/:id shows updated inventory Well Done - nice model method!
Overall
Great Work! Submission meets project expectations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants