Skip to content
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

pipes - Tamira and Saira - VideoStoreAPI #11

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
542241e
Initial set up
tvojnar Nov 6, 2017
9c4db7f
added customer, movie, and rental models
tvojnar Nov 6, 2017
9c4cc82
add relationships at the model level
tvojnar Nov 6, 2017
7952e10
add account_credit column to customer model
tvojnar Nov 6, 2017
c3ba982
added tests for customer model validations
tvojnar Nov 6, 2017
7721aea
Merge pull request #1 from tvojnar/customer-validations
tvojnar Nov 6, 2017
2d6bbc9
added error messages test to customer model tests
tvojnar Nov 6, 2017
c9ede5a
add tests for validations for rental model
tvojnar Nov 6, 2017
dfc651e
Merge pull request #2 from tvojnar/rental-validations
tvojnar Nov 6, 2017
291dedb
Tests pass for Movie validations
sairagula Nov 6, 2017
c62a0e1
merging
sairagula Nov 6, 2017
43040f2
added controller actions for MoviesController
sairagula Nov 6, 2017
d6597b8
tested MoviesController methods
sairagula Nov 6, 2017
c40a107
All tests pass for MoviesController
sairagula Nov 6, 2017
eea8e4e
add CustomersController index action with passing tests
tvojnar Nov 7, 2017
2b6dd81
Changing branches
sairagula Nov 7, 2017
6bba482
Model teting for Movie relationships
sairagula Nov 7, 2017
e1b1029
merging from branch
sairagula Nov 7, 2017
17a12a0
add checked_out column to customers
tvojnar Nov 7, 2017
bf0e11a
committing to be able to pull
tvojnar Nov 7, 2017
d0cdedd
removed checked_out column from rentals table and deleted what was in…
tvojnar Nov 7, 2017
c18261a
added back in the checked_out column cause do actually do want it
tvojnar Nov 7, 2017
863b5d6
got movies_checked_out_count to where it should be working, but need …
tvojnar Nov 7, 2017
a714ed6
movies_checked_out_count is working and being passed as part of the a…
tvojnar Nov 7, 2017
6607c40
got movies_checked_out_count to be passed in api response not using s…
tvojnar Nov 7, 2017
91c8435
Merge pull request #3 from tvojnar/movies-checked-out
tvojnar Nov 7, 2017
b2e1a01
committing to switch branches
sairagula Nov 7, 2017
43063d3
Merge branch 'master' of https://github.com/tvojnar/VideoStoreAPI
sairagula Nov 7, 2017
4f1a3c7
Merging
sairagula Nov 7, 2017
b63b8f0
Merge branch 'test_branch'
sairagula Nov 7, 2017
7174230
Added available_inventory method to Movie
sairagula Nov 7, 2017
afcd1ee
Model test passes for available inventory method
sairagula Nov 7, 2017
e3e356e
Model test added to movies_checked_out method
sairagula Nov 7, 2017
d1d5e18
Added foreign key relationships at the db level to the rentals model …
tvojnar Nov 7, 2017
4c53e22
Added test for has_many relationship for customer model to rentals
tvojnar Nov 7, 2017
7615e3d
added relationship tests for belongs_to for rentals to customer and m…
tvojnar Nov 7, 2017
57ae7ba
Merge pull request #4 from tvojnar/relationship-tests-tamira
tvojnar Nov 7, 2017
f77f8d0
wrote part of test for create and made it so checked_out will default…
tvojnar Nov 7, 2017
6bc172c
finished test for create
tvojnar Nov 7, 2017
2394d02
wrote create method and now positive create test is passing
tvojnar Nov 7, 2017
1bc48b2
Added test so that the db won't be changed if the request to create a…
tvojnar Nov 7, 2017
56dba43
Added passing test that a new rental won't be created without a movie_id
tvojnar Nov 7, 2017
e876a49
Added test that the correct data is sent back after the new instance …
tvojnar Nov 7, 2017
96f70a5
Merge pull request #5 from tvojnar/checkout
tvojnar Nov 7, 2017
36648e1
wrote positive case test for checkin
tvojnar Nov 7, 2017
d7d4510
positive test for checking in a movie passes
tvojnar Nov 7, 2017
c870cca
added test and functionality to handle when the rental being updated …
tvojnar Nov 7, 2017
3127ca5
Merge pull request #6 from tvojnar/checkin
tvojnar Nov 7, 2017
04051f5
added some comments to models and controllers
tvojnar Nov 8, 2017
bf4f76b
Merge pull request #7 from tvojnar/comments
tvojnar Nov 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
got movies_checked_out_count to where it should be working, but need …
…to add searializer to make sure it is working as expected
tvojnar committed Nov 7, 2017
commit 863b5d6616f95407cd55f2ef5ca9aa0640b5d044
2 changes: 1 addition & 1 deletion app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ class CustomersController < ApplicationController
def index
customers = Customer.all
render(
json: customers.as_json(only: [:id, :name, :registered_at, :address, :city, :state, :postal_code, :phone])
json: customers.as_json(only: [:id, :name, :registered_at, :address, :city, :state, :postal_code, :phone, :movies_checked_out_count])
)
end
end
2 changes: 1 addition & 1 deletion app/models/customer.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ class Customer < ApplicationRecord

validates :name, presence: true

def self.movies_checked_out
def movies_checked_out_count
self.rentals.where(checked_out: true).count
end # movies_checked_out