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

Natalia & Cynthia #19

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4fb27ff
generated controllers? models? seeeds
natalia-ku May 9, 2017
b4031ae
added missing fields to db tables
cynthiacd May 9, 2017
0bf8287
seeded customer data
cynthiacd May 9, 2017
b5a313a
seeded movies data
natalia-ku May 9, 2017
9029035
merged conflicts resolved
natalia-ku May 9, 2017
7e6293c
added movie validations in model
cynthiacd May 9, 2017
04f4c21
added movie fixtures
cynthiacd May 9, 2017
60170ce
added movie validation tests
cynthiacd May 9, 2017
dbdf7af
working on movies index method and testing
cynthiacd May 9, 2017
15a70a5
added tests for model Customer and customers controller
natalia-ku May 9, 2017
916e7a0
added tests for model Customer and customers controller
natalia-ku May 9, 2017
7559976
passing movie index tests
cynthiacd May 9, 2017
362d3e0
dryed up model validations testing
cynthiacd May 9, 2017
96245c5
added test for validation
natalia-ku May 9, 2017
44b83da
added movie show request
cynthiacd May 9, 2017
6236dcb
merged get_movies into master
cynthiacd May 9, 2017
c638a5f
added 2 tests for show movie method
natalia-ku May 10, 2017
9866184
fixed test for movies cotnroller
natalia-ku May 10, 2017
c99020e
added serializer for customers
natalia-ku May 10, 2017
4680f83
finished with test
natalia-ku May 10, 2017
d3c8eca
fixed test for movies show method
natalia-ku May 10, 2017
0152a5e
fixed typo in table column
natalia-ku May 10, 2017
6c2fdd6
added serializer for movies controller
cynthiacd May 10, 2017
8915dbc
typo in movie
natalia-ku May 10, 2017
7a43b5a
Merge branch 'master' of https://github.com/natalia-ku/VideoStoreAPI
natalia-ku May 10, 2017
23a7338
created rentals table and relationships between models
cynthiacd May 10, 2017
53e5072
Merge branch 'master' of https://github.com/natalia-ku/VideoStoreAPI
natalia-ku May 10, 2017
655a03c
added rental validations
cynthiacd May 10, 2017
a31bd11
Merge branch 'master' of https://github.com/natalia-ku/VideoStoreAPI
natalia-ku May 10, 2017
b488bb9
success test for rental validations
cynthiacd May 10, 2017
fb947e7
test for missing rental validations
cynthiacd May 10, 2017
e4b19a1
added create method for rentals
natalia-ku May 10, 2017
d69d9af
Merge branch 'nk-rentals'
cynthiacd May 10, 2017
b7ab645
have rental checkout method working
cynthiacd May 10, 2017
b23796e
create method for rentals
natalia-ku May 10, 2017
a840b8a
Merge branch 'nk-rentals' of https://github.com/natalia-ku/VideoStore…
natalia-ku May 10, 2017
aecc061
added get overdue ,ethod to Movie controller
natalia-ku May 10, 2017
473d60b
Merge branch 'master' of https://github.com/natalia-ku/VideoStoreAPI
natalia-ku May 10, 2017
710ab33
Merge branch 'nk-rentals' into rentals_checkout
natalia-ku May 10, 2017
95c6632
get overdue movies method works
natalia-ku May 10, 2017
6384a23
success test for rental create
cynthiacd May 10, 2017
5e3812f
added to rentals create success test
cynthiacd May 10, 2017
feac1e3
added failure case for rental create - bad customer id
cynthiacd May 10, 2017
e8d086e
made serializer for overdue works
natalia-ku May 11, 2017
d1a8c5c
add fail case for rental create given movie DNE
cynthiacd May 11, 2017
2d432a1
added update method for rentals
natalia-ku May 11, 2017
760f1fd
tests for Rental model overdue_movies method
natalia-ku May 11, 2017
c5b977c
added tests for controller overdue rentals method
natalia-ku May 11, 2017
6dd09c7
typis in routes
natalia-ku May 11, 2017
f69235a
tests working
natalia-ku May 11, 2017
5f0bc3f
cleaned up test files
cynthiacd May 11, 2017
65b53c1
merged rental overdue and checkin features
cynthiacd May 11, 2017
c5b5093
tsts for overdue_movies are orking
natalia-ku May 11, 2017
bb2ded9
fixed test for overdue movies in Rentals controller
natalia-ku May 11, 2017
4568570
working on checked in testing - found major bug
cynthiacd May 11, 2017
260436d
tests for overdue movies are working
natalia-ku May 12, 2017
0831f1e
make update inventory work in create method
natalia-ku May 12, 2017
8e0cebe
make update inventory work in create method
natalia-ku May 12, 2017
09db5de
create and update works but two tests now are failing
natalia-ku May 12, 2017
098049e
added a current duplicate rental check
cynthiacd May 12, 2017
dfb4c7b
available inventory working
natalia-ku May 12, 2017
34348b9
added available inventory method to controller
natalia-ku May 12, 2017
38f152b
working on rentals controller tests
cynthiacd May 12, 2017
4b370ee
added tests for update rental controller action
natalia-ku May 12, 2017
0ce4434
rental checkin and overdue passing tests
cynthiacd May 12, 2017
0fbb0c2
removed rental update tests to prepare for merge
cynthiacd May 12, 2017
04dbdb3
trying to refactor creTE IN RENTALS CONTROLLER
natalia-ku May 12, 2017
1675135
merged update and create tests for rentals
natalia-ku May 12, 2017
355a4d7
added tests for update and create method to test available inventroy …
natalia-ku May 12, 2017
517c060
added check inventory rental validation
cynthiacd May 12, 2017
d8eae4c
added check inventory rental validation
cynthiacd May 12, 2017
f15ff3d
added edge case inventory validation test
cynthiacd May 12, 2017
7888bd5
cleaning up rental validations tests
cynthiacd May 12, 2017
6947be1
cleaned up model files create_rental method
cynthiacd May 12, 2017
a993420
added tests for update and creTE
natalia-ku May 12, 2017
012f430
commented out controller and tests
natalia-ku May 12, 2017
2ed392f
merge inventory branches
cynthiacd May 12, 2017
0cb37b0
final clean up of files
cynthiacd May 12, 2017
b82c077
more spacing cleanuo
cynthiacd May 12, 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
created rentals table and relationships between models
cynthiacd committed May 10, 2017

Verified

This commit was signed with the committer’s verified signature.
DavyLandman Davy Landman
commit 23a7338afb95eeade6ca191c86af9796b591b888
2 changes: 1 addition & 1 deletion app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ def show
if movie == nil
render status: :not_found, json:{
"404 error": { "title": ["Movie #{params[:title]} not found"] }
}
}
else
render json: movie, status: :ok
end
3 changes: 2 additions & 1 deletion app/models/customer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Customer < ApplicationRecord

has_many :rentals

validates :name, presence: true

validates :registered_at,presence: true
1 change: 1 addition & 0 deletions app/models/movie.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Movie < ApplicationRecord
has_many :rentals
validates :title, presence: true, uniqueness: true
validates :overview, presence: true
validates :release_date, presence: true
2 changes: 2 additions & 0 deletions app/models/rental.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Rental < ApplicationRecord
end
13 changes: 13 additions & 0 deletions db/migrate/20170510174106_create_rentals.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateRentals < ActiveRecord::Migration[5.0]
def change
create_table :rentals do |t|
t.belongs_to :movie
t.belongs_to :customer
t.date :check_out_date
t.date :return_date
t.date :due_date
t.string :status
t.timestamps
end
end
end
15 changes: 14 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170509212649) do
ActiveRecord::Schema.define(version: 20170510174106) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -38,4 +38,17 @@
t.datetime "updated_at", null: false
end

create_table "rentals", force: :cascade do |t|
t.integer "movie_id"
t.integer "customer_id"
t.date "check_out_date"
t.date "return_date"
t.date "due_date"
t.string "status"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["customer_id"], name: "index_rentals_on_customer_id", using: :btree
t.index ["movie_id"], name: "index_rentals_on_movie_id", using: :btree
end

end
11 changes: 11 additions & 0 deletions test/fixtures/rentals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

# This model initially had no columns defined. If you add columns to the
# model remove the "{}" from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
9 changes: 9 additions & 0 deletions test/models/rental_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "test_helper"

describe Rental do
let(:rental) { Rental.new }

it "must be valid" do
value(rental).must_be :valid?
end
end