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

Jillian & Jade's EXTREME VIDEO EXPRESS (it's the 90s) API!!!!!11!!!!1! kewl. #3

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
b10191e
Wrote pseudocode for routes.
jadevance Jun 14, 2016
7e69068
Added in Massive
jadevance Jun 14, 2016
f80ff64
added db and db/setup dirs, added scripts for setups in the package.j…
JBoshart Jun 14, 2016
fe3633f
omg it works
jadevance Jun 14, 2016
3f994c9
added high level routes for customers, movies and rentals
jadevance Jun 15, 2016
bbec298
Added tasks folder with load schema functionality
jadevance Jun 15, 2016
448164b
Pushing broken code so we can work on it tonight: Most of the work do…
JBoshart Jun 15, 2016
a46f4b2
Changed some things?
jadevance Jun 16, 2016
e0611b6
merge conflicts
jadevance Jun 16, 2016
bb8ed63
Seed.js is now working.
JBoshart Jun 16, 2016
df311ed
Added schema for rentals database.
JBoshart Jun 16, 2016
cf69655
Added ERD to git.
JBoshart Jun 16, 2016
9aa4d2b
added setup for the database in app.js
jadevance Jun 16, 2016
e929b92
added a models folder as well as model function to find all customers
jadevance Jun 16, 2016
cc7ebf3
wrote a method in the video controller to find all customers in the d…
jadevance Jun 16, 2016
de5b757
forgot to reference the model in the controller. Fixed that. Renamed …
jadevance Jun 16, 2016
944c7a9
resolved merge conflict.
JBoshart Jun 16, 2016
38d4c13
Added module.exports to app
jadevance Jun 16, 2016
e4ff73c
required massive and cleaned up errors
jadevance Jun 16, 2016
22e7117
Fixed a syntax error that broke everything
jadevance Jun 17, 2016
fca5fdd
Switching drivers. Working on getting JSON response.
JBoshart Jun 17, 2016
4117137
endpoint customers is now serving up customer data in JSON
jadevance Jun 17, 2016
1dc233a
renamed video.js to customers.js to split out the functionality of cu…
jadevance Jun 17, 2016
a1f4b7f
Organizational changes only.
JBoshart Jun 17, 2016
7e73318
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 17, 2016
22c9cc3
More org changes.
JBoshart Jun 17, 2016
e704d83
Added functionality for sorting customers
jadevance Jun 17, 2016
59ed614
managing merge conflicts
jadevance Jun 17, 2016
dd0eabe
Customers can be sorted now and the return is JSON data. yay
jadevance Jun 17, 2016
dc60de7
Set h1 for funsies.
JBoshart Jun 17, 2016
3ff63c7
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 17, 2016
ef395bf
Made models and controllers for rentals and videos.
JBoshart Jun 17, 2016
dacb023
added seed data for rentals database, and adjusted seeding code.
JBoshart Jun 17, 2016
2b4eeda
broke out routes for clarity (and because express had callback issues…
jadevance Jun 17, 2016
b259277
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
jadevance Jun 17, 2016
65ab567
work in rentals model and controller.
JBoshart Jun 17, 2016
e18f050
fixed routing where it was nested one level too deep (/customers/cust…
jadevance Jun 17, 2016
75164a2
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
jadevance Jun 17, 2016
ef2faa5
Working on Rentals.find in controller.
JBoshart Jun 17, 2016
3c56b1f
routes
jadevance Jun 17, 2016
a2faf4f
still. with. rentals. find. :(
JBoshart Jun 17, 2016
8ca4618
merge conflicts manages in app.js and rentals controller
jadevance Jun 17, 2016
b87aea8
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
jadevance Jun 17, 2016
2970cb0
Completed the find_current rentals funciton in model and contorller. …
JBoshart Jun 17, 2016
e41e909
friday changes, honestly do not remember what was changed
jadevance Jun 20, 2016
8a017c0
added istanbul and managed a merge conflict with rentals routes
jadevance Jun 20, 2016
f74c963
Added more seed data inorder to test sorting function of rentals hist…
JBoshart Jun 20, 2016
4da9636
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 20, 2016
37ab377
Added null seeds for checkin and modified the models sql query to ret…
jadevance Jun 20, 2016
0241bc0
Added coverage to the gitignore file
jadevance Jun 20, 2016
c80b182
resolving errors that occured when coverage/ was not in our git ignore.
JBoshart Jun 20, 2016
c7c524c
Trying to resolved merge
JBoshart Jun 20, 2016
4162e25
Added node modules to the .gitignore
jadevance Jun 20, 2016
23a8b4d
video_current now returns the customers who currently have a particul…
JBoshart Jun 20, 2016
ee69dd8
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 20, 2016
3ae103b
Wrote a function, route and model method for finding the rental histo…
jadevance Jun 20, 2016
857b62b
Wrote functionality for funding a list of customers who have currentl…
jadevance Jun 20, 2016
f450b9b
Worked on adding checkout functionality to our video store. Routing n…
jadevance Jun 21, 2016
fd2f0c5
debugging code, have the first two pieces of checkout working but the…
jadevance Jun 21, 2016
61d640f
Created a constructor function to test checkout rentals
jadevance Jun 21, 2016
a155863
Fixed date and time
jadevance Jun 21, 2016
de7a513
Worked on rentals checkin function.
JBoshart Jun 21, 2016
7221273
Debugging work on checking process.
JBoshart Jun 21, 2016
85797a9
Checkin function is now working
JBoshart Jun 21, 2016
1a25dd2
Fixed error handling to display json rather than render a view for er…
jadevance Jun 21, 2016
34aa7a5
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
jadevance Jun 21, 2016
76fcb75
Wrote error handling for customers, cleaned up unused code
jadevance Jun 21, 2016
b5cb520
added video error handling
jadevance Jun 21, 2016
1fcd557
Working on overdue rentals.
JBoshart Jun 21, 2016
9fc2fc3
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 21, 2016
b715f0f
Wrote tests for the videos controller (renamed from movies for clarit…
jadevance Jun 22, 2016
92a93db
Added tests for customers controller.
jadevance Jun 22, 2016
070171c
Wrote some tests for the rentals controller
jadevance Jun 22, 2016
d537234
Merging tests with local
JBoshart Jun 22, 2016
72dfb1b
overdue function for rentals is now working.
JBoshart Jun 22, 2016
21fc575
Added model specs and cleaned up error responses in the controllers
jadevance Jun 22, 2016
33fe746
Made rentals#overdue tests, as well as model spec directory.
JBoshart Jun 22, 2016
cf20434
isolated the failing test and it is currently x and commented out in …
jadevance Jun 22, 2016
45c0130
Managing merge conflicts, commented out tests that do not currently work
jadevance Jun 23, 2016
33e1b27
Fixed failing test, endpoint had a typo
jadevance Jun 23, 2016
c5bc420
writing model tests for customers
jadevance Jun 23, 2016
b08e506
Added in package.json command to clean up test coverage reports
jadevance Jun 23, 2016
f54b3b2
Added new testing command to package.json.
JBoshart Jun 23, 2016
db2982b
Added tests to the rental models spec for find_current and find_history.
JBoshart Jun 23, 2016
6995b8f
Added tests to rentals model spec for .overdue.
JBoshart Jun 23, 2016
d08365a
Added tests to rentals model spec for .video_current.
JBoshart Jun 23, 2016
3ae0f78
Added tests to rentals model spec for .video_current, more will need …
JBoshart Jun 23, 2016
83e3f06
Wrote a sorting function for rentals to return JSON data sorted by name
jadevance Jun 23, 2016
345ad66
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 23, 2016
d451759
added notes to remind us to address checkout date
jadevance Jun 23, 2016
c0506d2
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
jadevance Jun 23, 2016
9b7606e
Handled checkout date logic for sorting
jadevance Jun 23, 2016
d55204e
More tests in progress.
JBoshart Jun 23, 2016
9f7da07
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 23, 2016
d808692
Sorting tests for find_video_history
JBoshart Jun 23, 2016
dd5593c
Wrote tests for video model. I think we should write some tests for .…
JBoshart Jun 23, 2016
4f0e70e
error handling tests for models controllers is now in place and at 91…
JBoshart Jun 24, 2016
dfdf543
customers spec is now testing at 94% coverage.
JBoshart Jun 24, 2016
a373466
wrote tests for rentals to handle error handling
jadevance Jun 24, 2016
fae25cf
cleaning up the files
jadevance Jun 24, 2016
34d7557
Removed views that were not being used. Added Api Documentation.
JBoshart Jun 24, 2016
ceba217
Merge branch 'master' of github.com:JBoshart/VideoStoreAPI
JBoshart Jun 24, 2016
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
File renamed without changes.
24 changes: 12 additions & 12 deletions db/setup/schema.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
DROP TABLE IF EXISTS videos;
CREATE TABLE videos(
id serial PRIMARY KEY,
title text,
overview text,
release_date date,
inventory integer,
available_inventory integer
)

DROP TABLE IF EXISTS customers;
CREATE TABLE customers(
id serial PRIMARY KEY,
@@ -16,7 +6,17 @@ CREATE TABLE customers(
address text,
city text,
state text,
postal_code integer,
phone integer,
postal_code text,
phone text,
account_credit integer
);

DROP TABLE IF EXISTS videos;
CREATE TABLE videos(
id serial PRIMARY KEY,
title text,
overview text,
release_date date,
inventory integer,
available_inventory integer
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay SQL!

49 changes: 49 additions & 0 deletions npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/6.2.1/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'db:reset' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predb:reset', 'db:reset', 'postdb:reset' ]
5 info lifecycle [email protected]~predb:reset: [email protected]
6 silly lifecycle [email protected]~predb:reset: no script for predb:reset, continuing
7 info lifecycle [email protected]~db:reset: [email protected]
8 verbose lifecycle [email protected]~db:reset: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~db:reset: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/jillianboshart/C5/projects/VideoStoreAPI/node_modules/.bin:/usr/local/Cellar/node/6.2.1/bin:/user/jillianboshart/bin:/usr/local/bin:/Users/jillianboshart/.rvm/gems/ruby-2.3.1/bin:/Users/jillianboshart/.rvm/gems/ruby-2.3.1@global/bin:/Users/jillianboshart/.rvm/rubies/ruby-2.3.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/user/jillianboshart/bin:/Users/jillianboshart/.rvm/gems/ruby-2.3.1/bin:/Users/jillianboshart/.rvm/gems/ruby-2.3.1@global/bin:/Users/jillianboshart/.rvm/rubies/ruby-2.3.1/bin:/Users/jillianboshart/.rvm/bin:/Users/jillianboshart/.rvm/bin:/Users/jillianboshart/.rvm/bin
10 verbose lifecycle [email protected]~db:reset: CWD: /Users/jillianboshart/C5/projects/VideoStoreAPI
11 silly lifecycle [email protected]~db:reset: Args: [ '-c',
11 silly lifecycle 'npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed' ]
12 silly lifecycle [email protected]~db:reset: Returned: code: 1 signal: null
13 info lifecycle [email protected]~db:reset: Failed to exec db:reset script
14 verbose stack Error: [email protected] db:reset: `npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:245:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:852:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/jillianboshart/C5/projects/VideoStoreAPI
17 error Darwin 15.5.0
18 error argv "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/bin/npm" "run" "db:reset"
19 error node v6.2.1
20 error npm v3.9.3
21 error code ELIFECYCLE
22 error [email protected] db:reset: `npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed`
22 error Exit status 1
23 error Failed at the [email protected] db:reset script 'npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the video-store-api package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed
23 error You can get information on how to open an issue for this project with:
23 error npm bugs video-store-api
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls video-store-api
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"db:drop": "dropdb extreme_video_express",
"db:create": "createdb extreme_video_express",
"db:schema": "clear; node tasks/load_schema.js",
"db:seed": "node tasks/seed.js",
"db:seed": "clear; node tasks/seed.js",
"db:reset": "npm run db:drop; npm run db:create; npm run db:schema; npm run db:seed"
},
"dependencies": {
68 changes: 68 additions & 0 deletions tasks/seed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
var massive = require('massive')
var connectionString = "postgres://localhost/extreme_video_express"
var db = massive.connectSync({connectionString : connectionString})

var video_data = require("../db/seeds/videos.json")
var cust_data = require("../db/seeds/customers.json")

var video_records = video_data.length
var cust_records = cust_data.length

// This will count the number of records and tell us if the seeding has completed
// function checkFinish() {
// db.videos.count(function(err, res1) {
// console.log("videos in db: ", res1)
// if (res1 >= video_records) {
// console.log("Yay! I'm done with videos!")
// db.customers.count(function(err, res2) {
// console.log("customers in db: ", res2)
// if (res2 >= cust_records) {
// console.log("Yay! I'm done with customers!")
// process.exit()
// }
// })
// }
// })
// }

var check1 = function checkVideo() {
db.videos.count(function(err, res) {
console.log("videos in db: ", res)
if (res >= video_records) {
console.log("Yay! I'm done with videos!")
return true;
}
})
}

var check2 = function checkCust() {
db.customers.count(function(err, res) {
console.log("customers in db: ", res)
if (res >= cust_records) {
console.log("Yay! I'm done with customers!")
return true;
}
})
}

var make = function(){
for (var record of video_data) {
db.videos.save(record, function(err, res) {
console.log("saved: ", JSON.stringify(res))
check1()
})
}

for (var record of cust_data) {
db.customers.save(record, function(err, res) {
console.log("saved: ", JSON.stringify(res))
check2()
})
}

if ((check1() === true) && (check2() === true)) {
process.exit()
}
}

make()