Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
c93800a
db file stuff
THEJNIGH Feb 13, 2016
1043d37
hello?
THEJNIGH Feb 13, 2016
e366ae0
Database stuff
THEJNIGH Feb 13, 2016
43e3a9b
Add Unit Test Example
reactivepixel Feb 13, 2016
32e511f
Added License & Contribute files
therealaldo Feb 13, 2016
99167ec
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 13, 2016
516e345
listed team members
therealaldo Feb 13, 2016
87c35e8
fixed request and response objects in readme
therealaldo Feb 13, 2016
e221ee9
fixed readme
therealaldo Feb 13, 2016
48cff27
added model folder
THEJNIGH Feb 13, 2016
243b1a5
Add Unit Tests
reactivepixel Feb 13, 2016
80479aa
Setup sequelize connection.
THEJNIGH Feb 13, 2016
93e0935
Added database installation to readme.
THEJNIGH Feb 13, 2016
7359ab4
Created models and tables for database
Feb 13, 2016
7234546
changed readme
Feb 13, 2016
01a4f08
updated database
therealaldo Feb 14, 2016
32c6ca1
trying to fix onflicts
therealaldo Feb 14, 2016
deb6669
fixed readme
therealaldo Feb 14, 2016
ed79a1e
added use strict to all necessary files
therealaldo Feb 16, 2016
47f0eb5
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
77df028
remove
therealaldo Feb 16, 2016
feb646e
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
2d0eb1b
added dotenv to devDependencies
therealaldo Feb 16, 2016
66ba927
added dotenv to dev dependencies
therealaldo Feb 16, 2016
258702c
added faker to dev dependencies
therealaldo Feb 16, 2016
4b92450
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
207cdb4
Added procfile for starting heroku
therealaldo Feb 16, 2016
7170069
moved create table functions to db.js so you only have to run 1 file …
Feb 16, 2016
29307a6
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
b3647df
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity …
Feb 16, 2016
4a22b4d
changed package.json
therealaldo Feb 16, 2016
1107919
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
3331767
Cleaning up code
therealaldo Feb 16, 2016
0f9d9e2
pulled from order_bot
therealaldo Feb 16, 2016
c0f3988
fixed small errors
therealaldo Feb 16, 2016
7f9f557
fixing errors from pull request
therealaldo Feb 16, 2016
3f57ba6
Merge branch 'order_bot' of https://github.com/reactivepixel/Gravity
therealaldo Feb 16, 2016
12458d1
fixed errors from pull request
therealaldo Feb 16, 2016
46060b9
Created an unit test to test if the uuid and the timestamp to is mat…
Keownc Feb 16, 2016
cd22f3c
Getting rid of errors in models
Feb 16, 2016
33a0e03
inserts items into database
Feb 16, 2016
27b89b8
first attempt at order/create
therealaldo Feb 18, 2016
48c1ae0
creating order and orderedItem
therealaldo Feb 18, 2016
e9ce9af
changed request hits to 1
therealaldo Feb 19, 2016
e2d09fe
Adding data to the database dynamically
Feb 19, 2016
c1fcf61
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
Feb 19, 2016
8ffa0d9
created unit test file
therealaldo Feb 19, 2016
260d631
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 19, 2016
e20e81b
started unit testing db
THEJNIGH Feb 22, 2016
f58ced7
add chai
THEJNIGH Feb 22, 2016
239cda5
Unit testing yay
THEJNIGH Feb 23, 2016
0c3d40c
Combine the new test into the default test
Keownc Feb 23, 2016
e69f06c
committing changes
therealaldo Feb 23, 2016
dcbe632
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 23, 2016
806609a
deleted file
therealaldo Feb 23, 2016
e26faab
changed recipients to recipient
therealaldo Feb 23, 2016
16b2383
change test environment port to 1234 so that you can run the server a…
jamesalexanderdickerson Feb 23, 2016
5b5061a
merging unittest
therealaldo Feb 23, 2016
c708a08
trying to push unittest
therealaldo Feb 23, 2016
254133d
OH NO, SOMETHING BROKE
THEJNIGH Feb 24, 2016
e347739
Merge conflict:
THEJNIGH Feb 24, 2016
8e99acc
Corrected Models and PUT Route
therealaldo Feb 24, 2016
b83bfe7
fixed syntax
therealaldo Feb 24, 2016
4512181
working on new routes
THEJNIGH Feb 24, 2016
9bc2a40
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 24, 2016
6951bc4
order route is working with new models
therealaldo Feb 24, 2016
9c44140
removed unnecessary let variable
therealaldo Feb 24, 2016
70a44ac
Create unit testing works
THEJNIGH Feb 24, 2016
53bcd64
changed route and added foreign key
therealaldo Feb 25, 2016
210996e
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 25, 2016
be3fd2f
SOMETHING BROKE WTF
THEJNIGH Feb 25, 2016
159a70c
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 25, 2016
4ec5d15
changed model for orders, orderedItems, and db.js
jamesalexanderdickerson Feb 25, 2016
6709beb
fixed models, route
therealaldo Feb 25, 2016
ac88fb5
removed commetned route
therealaldo Feb 25, 2016
d1f9059
changed inventory model and units model
chrisfortin16 Feb 25, 2016
8df122d
fixed postinstall on package.json file
chrisfortin16 Feb 25, 2016
707bda5
My test works?
THEJNIGH Feb 26, 2016
d29a6f8
changed route
therealaldo Feb 26, 2016
132cb18
fixed merge conflicts in test
therealaldo Feb 26, 2016
d5d9b2f
files from google hangout
therealaldo Feb 27, 2016
1d78bd1
trying to fix route
therealaldo Feb 27, 2016
ba3a610
Added findall to orders route
THEJNIGH Feb 27, 2016
9122b98
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 27, 2016
5beb439
Fixed models to find where data = payload
chrisfortin16 Feb 27, 2016
95c479f
Unit tested all of order route CRUD
THEJNIGH Feb 27, 2016
a911065
Unit tested routes
THEJNIGH Feb 27, 2016
37fce21
Fixed merge conflict
THEJNIGH Feb 27, 2016
e701930
added async to packages
therealaldo Feb 27, 2016
ea96f1d
Completed PUT route using async.waterfall
therealaldo Feb 27, 2016
fa90d4b
Enhanced comments
therealaldo Feb 27, 2016
5a3a184
Added inventory route
Feb 27, 2016
1cb9d19
fixed inventory model and added inventory route in server.js
Feb 27, 2016
ee6a364
added testing file for ordered items
THEJNIGH Feb 27, 2016
672966f
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 27, 2016
c9ec228
fixed syntax error on inventory route
Feb 28, 2016
c8591d7
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
Feb 28, 2016
68fad90
added units route and fixed units model
Feb 28, 2016
2bf6b10
Working on orderedItems route and unit testing
THEJNIGH Feb 28, 2016
9d63333
Fixed merge conflict
THEJNIGH Feb 28, 2016
2cad358
Modified the variables which were being saved
therealaldo Feb 28, 2016
21292b9
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 28, 2016
0ebcf05
fixed syntax errors
therealaldo Feb 28, 2016
5449797
removed timestamp from units route
therealaldo Feb 28, 2016
26d7924
removed timestamp from inventory route
therealaldo Feb 28, 2016
8cfd8e9
added .findAll to models along with cleaning the put routes up
therealaldo Feb 28, 2016
6c5fed3
fixed units model
Feb 28, 2016
6c9d9bd
fixed inventory route
therealaldo Feb 28, 2016
2805ccb
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
therealaldo Feb 28, 2016
d55af67
fixed units route
therealaldo Feb 28, 2016
64bf708
More unit testing
THEJNIGH Feb 28, 2016
9b4dca1
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 28, 2016
d19ab4b
Restructured readme file
chrisfortin16 Feb 28, 2016
472706f
modified inventory route to go to specific sku
Feb 28, 2016
469a31c
Unit tests working for orderedItems and Order routes
THEJNIGH Feb 28, 2016
fa63151
Merge branch 'db_create' of github.com:reactivepixel/Gravity into db_…
THEJNIGH Feb 28, 2016
5a48ee8
modified units route to go to specific sku
Feb 28, 2016
0ffd8af
created units.js file for unit testing
chrisfortin16 Feb 28, 2016
bab7960
added inventory unit test
Feb 28, 2016
5584048
Merge branch 'db_create' of https://github.com/reactivepixel/Gravity …
Feb 28, 2016
ca60782
modified inventory unit test
therealaldo Feb 28, 2016
872abdf
fixed syntax errors
Feb 28, 2016
94e2907
Fixing tests
THEJNIGH Feb 28, 2016
fbfa34b
working on inventory unit test
therealaldo Feb 28, 2016
b1beb0f
changed around __units.js file
chrisfortin16 Feb 28, 2016
9e0d81e
One last change from uuid to sku
chrisfortin16 Feb 28, 2016
de76788
Update readme.md
reactivepixel Apr 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
19 changes: 19 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* CONTRIBUTE */

This is the contribute.md of our project. Great to have you here. Here are a few ways you can help make this project better!

# Contribute.md

## Team members

This section introduces the core team members.

* James Dickerson
* Misha Devine
* Keown Creese
* Chris Fortin
* Aldo Gonzalez
* Jacob Nigh
* Tyler Richard
* Brad Beltowski
* Chris Chapman
8 changes: 8 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2016 Gravity

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server/server.js
52 changes: 52 additions & 0 deletions models/inventory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
module.exports = function() {
const db = require('../server/db.js');
const sequelize = db.connection;

function _create(data, err, success) {
let payload = data;
db.inventory.create(payload)
.then(success)
.catch(err);
}

function _update(data, err, success) {
let payload = data;
db.inventory.find({where: {sku: payload.sku}})
.then(function(matchedOrder) {
matchedOrder.updateAttributes(data)
.then(success)
.catch(err)
})
.catch(err)
}

function _find(data, err, success) {
let payload = data;
db.inventory.findAll({where: {sku: payload.sku}})
.then(success)
.catch(err);
}

function _findAll(err, success) {
db.inventory.findAll()
.then(success)
.catch(err);
}

function _destroy(data, err, success) {
let payload = data;
db.inventory.destroy({where: {sku: payload.sku}})
.then(success)
.catch(err);
}

return {
create: _create,
update: _update,
find: _find,
findAll: _findAll,
destroy: _destroy
}

}();
54 changes: 54 additions & 0 deletions models/ordered-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict';
module.exports = function() {
const db = require('../server/db.js');
const sequelize = db.connection;

function _create(data, err, success) {
for(let i = 0; i < data.units.length; i++) {
data.units[i].uuid = data.uuid;
db.orderedItems.create(data.units[i])
.then(success)
.catch(err);
}
}

function _update(data, err, success) {
let payload = data;
db.orderedItems.find({where: {uuid: payload.uuid}})
.then(function(matchedOrder) {
matchedOrder.updateAttributes(data)
.then(success)
.catch(err);
})
.catch(err);
}

function _find(data, err, success) {
let payload = data;
db.orderedItems.findAll({where: {uuid: payload.uuid}})
.then(success)
.catch(err);
}

function _findAll(err, success) {
db.orderedItems.findAll()
.then(success)
.catch(err);
}

function _destroy(data, err, success) {
let payload = data;
db.orderedItems.destroy({where: {uuid: payload.uuid}})
.then(success)
.catch(err);
}

return {
create: _create,
update: _update,
find: _find,
findAll: _findAll,
destroy: _destroy
}

}();
52 changes: 52 additions & 0 deletions models/orders.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
module.exports = function() {
const db = require('../server/db.js');
const sequelize = db.connection;

function _create(data, err, success) {
let payload = data;
db.orders.create(data)
.then(success)
.catch(err);
}

function _update(data, err, success) {
let payload = data;
db.orders.find({where: payload})
.then(function(matchedOrder) {
matchedOrder.updateAttributes(data)
.then(success)
.catch(err);
})
.catch(err);
}

function _find(data, err, success) {
let payload = data;
db.orders.find({where: payload})
.then(success)
.catch(err);
}

function _findAll(err, success) {
db.orders.findAll()
.then(success)
.catch(err);
}

function _destroy(data, err, success) {
let payload = data;
db.orders.destroy({where: {uuid: payload.uuid}})
.then(success)
.catch(err);
}

return {
create: _create,
update: _update,
find: _find,
findAll: _findAll,
destroy: _destroy
}

}();
52 changes: 52 additions & 0 deletions models/units.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
module.exports = function() {
const db = require('../server/db.js');
const sequelize = db.connection;

function _create(data, err, success) {
let payload = data;
db.units.create(payload)
.then(success)
.catch(err);
}

function _update(data, err, success) {
let payload = data;
db.units.findAll({where: {sku: payload.sku}})
.then(function(matchedOrder) {
matchedOrder.updateAttributes(data)
.then(success)
.catch(err);
})
.catch(err);
}

function _find(data, err, success) {
let payload = data;
db.units.findAll({where: {sku: payload.sku}})
.then(success)
.catch(err)
}

function _findAll(err, success) {
db.units.findAll()
.then(success)
.catch(err)
}

function _destroy(data, err, success) {
let payload = data;
db.units.destroy({where: {sku: payload.sku}})
.then(success)
.catch(err);
}

return {
create: _create,
update: _update,
find: _find,
findAll: _findAll,
destroy: _destroy
}

}();
33 changes: 15 additions & 18 deletions order_bot/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const request = require('request');
const faker = require('faker');

// Hits variable controls how many times the request loop will autoamtically run
let hits = 900;
let hits = 1;

// Automated request loop
let i;
Expand All @@ -13,25 +13,22 @@ for(i = 0; i < hits; i++) {
* Faker API documentation at https://github.com/marak/faker.js
*/
const payload = {
units: [
"units": [
{
sku: 'a5296ab9-9eee-7ba0-0a79-b801594f2c91',
quantity: faker.random.number()},
"sku": 'a5296ab9-9eee-7ba0-0a79-b801594f2c91',
"quantity": 5},
{
sku: 'a5296ab9-9eee-7ba0-0a79-b801594f2c92',
quantity: faker.random.number()}
],
recipients: {
name: faker.name.findName(),
address: {
street: faker.address.streetAddress(),
city: faker.address.city(),
state: faker.address.stateAbbr(),
zip: faker.address.zipCode()
},
phone: faker.phone.phoneNumberFormat(),
email: faker.internet.email()
}
"sku": 'a5296ab9-9eee-7ba0-0a79-b801594f2c92',
"quantity": 2}
],

"fullName": "James Dickerson",
"streetAddress": "14250 Cheval Mayfaire",
"city": "Orlando",
"state": "FL",
"zip": "32828",
"phone": "305-710-8220",
"email": "jamesalexanderdickerson@gmail.com"
};

/**
Expand Down
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@
"main": "server.js",
"scripts": {
"test": "echo \"Tests not setup yet\" && exit 0",
"start": "node server.js"
"start": "node server/server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/reactivepixel/Gravity.git"
},
"author": "",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/reactivepixel/Gravity/issues"
},
"homepage": "https://github.com/reactivepixel/Gravity#readme",
"dependencies": {
"async": "1.5.2",
"body-parser": "1.15.0",
"express": "4.13.4",
"faker": "3.0.1",
"mysql": "2.10.2",
"request": "2.69.0",
"sequelize": "3.19.2"
},
"devDependencies": {
"dotenv": "2.0.0",
"faker": "3.0.1",
"mocha": "2.4.5",
"supertest": "1.2.0"
}
}
Loading