Skip to content

Comments

Fire- Video-Store-Api- Pauline and Kalki #19

Open
KayKay-git wants to merge 50 commits intoAda-C14:masterfrom
ghostfruitleaf:master
Open

Fire- Video-Store-Api- Pauline and Kalki #19
KayKay-git wants to merge 50 commits intoAda-C14:masterfrom
ghostfruitleaf:master

Conversation

@KayKay-git
Copy link

@KayKay-git KayKay-git commented Dec 3, 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 Reading through the documentation, we saw that the relationships between customers and videos were mostly through rentals, which made sense to us to be its own model that held a “connection” between a customer and a video. Thus, applying that a customer could have multiple rentals (videos_checked_out_count), and videos had at least 1 or more inventory to rent-out, we settled on a one-to-many customer->video video->customer relationship through rentals, which customers and videos had a one-to-many relationship with. A rental belongs to only one video and one customer that it “links” together based on the endpoint docs.
What would be the Big-O time complexity of your /customers & /videos endpoints? What does the time complexity depend on? Explain your reasoning. The time complexity is O(n) because it's an index list in JSON format where n represents the number of customers or videos which is based on the data in our db. The larger the db the longer the run time will be.
What is the Big-O time complexity of the POST /rentals/check-in endpoint? What does the time complexity depend on? Explain your reasoning. This should be an O(1) complexity. Check-in relies on an existing rental and at most would change its fields, and no new rentals are created. Likewise, the rental being checked-in is linked to and modifies the records of only one existing customer and one existing video at a time, and always modifies the same number of records. This means that POST /rentals/check-in is an action that performs the same number of operations regardless of the size of the database, and the relevant related objects have already been linked to the rental due to model relations
Describe a specific set of positive and negative test cases you implemented for a model. Customer Model: Returns success status and a hash with proper fields for an existing customer. Negative test, if customer is not found returns a not found status with a Not Found error message.
Describe a specific set of positive and negative test cases you implemented for a controller. For a controller, to test whether the Videos controller’s show method worked, two tests needed to be implemented: 1) That the controller returned 200 status could get the information of a video existing in the database and return certain requested fields in a JSON for that video, and 2) that the controller returned a JSON and 404 status if a video wasn’t found (through an invalid video id), with the JSON listing error details.
Broadly, describe how an API should respond when it handles a request with invalid/erroneous parameters. An API should respond with a JSON that will contain the status and an error message that was triggered by the bad request.
Describe one of your custom model methods and why you chose to wrap that functionality into a method. One method in the videos controller was a method to validate that the release_date field could be parsed into a date in the event that the user (for a future feature) wanted to sort movies by their release date, and also since the field is stored as a string (mostly because Pauline was struggling to find the right parser to keep the formatting of the seeds). This was incorporated as a custom model validation.

6:17

ghostfruitleaf and others added 30 commits December 1, 2020 13:18
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