-
Notifications
You must be signed in to change notification settings - Fork 28
Raisah & Kelsey #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Raisah & Kelsey #28
Conversation
Added Customer & Movie models
Added Customers controller & tests
Movies index, show, create controller actions and tests
Rental model
Rentals model and controller updates
Rentals controller actions and tests
Refactored tests and added validation for Movie
Custom model methods for Customers model tests and methods
Added model initialize tests for Customer, Rental, Movie
Customers tests
Update to Rental#create action
Refactored to controller and model test code
Inventory mgmt Added Postman collection of tests for Optionals
Video StoreWhat We're Looking For
|
| rental.checkout_date = Date.today | ||
| rental.due_date = Date.today + 7 | ||
|
|
||
| if rental.movie.available_inventory > 0 && rental.save |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Determining what is/isn't business logic is definitely a slowly acquired taste and y'all did a great job.
I wanted to add that the logic to determine whether something is safe to execute (in this case whether the rental is safe to save) is safest in its own model method so it's very clear where/how that judgement call is being made.
This is definitely a level beyond what we've taught so far but wanted to throw it out there.
| render json: { ok: false, "errors" => ["unable to create rental"]}, status: :bad_request | ||
| return | ||
| end | ||
| if Movie.find(params[:movie_id]) && Customer.find(params[:customer_id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 9-12 could appropriately be pulled out into 1 or 2 model methods. but that's getting on the nit-picky side for sure.
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
POST /rentals/check-inendpoint? What does the time complexity depend on? Explain your reasoning.