Skip to content

Conversation

@RenCarothers
Copy link

@RenCarothers RenCarothers commented Dec 4, 2020

Assignment Submission: Video Store API

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

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.

Reflection

Prompt Response
Explain how you came up with the initial design of your ERD, based on the seed data and reading through the API endpoints We knew we needed a customer and video model, and knew which attributes we needed based on the wiki. We discerned that we needed a rental model based on the checkout/checkin endpoints and their expected response bodies. We knew that we could use relationships to tie a customer and video to a rental.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. O(n) - where n is/depends on the quantity of customers/videos; as the list gets larger, complexity increases linearly with the quantity.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. O(n) - because of the Customer.find_by & Video.find_by - where n is/depends on the quantity of customers/videos; as the list gets larger, the worst case complexity increases as .find_by may have to search through the entire list.
Describe a specific set of positive and negative test cases you implemented for a model. For one custom method (for checkout), we checked if video available inventory was less than 1 (negative); greater than 1 (positive).
Describe a specific set of positive and negative test cases you implemented for a controller. For our rental controller checkout method, we tested if a rental was successfully created (with correct attributes) when handed valid request parameters (positive case), vs when handed invalid customer/video ids, if our method correctly passed a 404 response (negative case).
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. An API should respond with a (error related) status code and a response body that has an errors hash with details about the error.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. To render JSON for checkout/checkin that had both the rental model attributes included as well as the video.available_inventory and customer.videos_checked_out_count, we created a method for customer & video that returned the attribute we wanted, that we could then call in our JSON rendering.

Ren Carothers and others added 26 commits December 1, 2020 19:44
added create action, fixed tests and smoke tests
…laying available_inventory, videos_check_out_count
adds basic controller tests for checkin and out methods
Added custom methods tests for rental model
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.

2 participants