Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update seed file to add products to orders
  • Loading branch information
yinishi committed Jun 14, 2016
1 parent 07a2a47 commit 2eae8d5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions seed.js
Expand Up @@ -109,14 +109,26 @@ var products = [{
}]

var orders = [{
status: 'Created',
status: 'Completed',
userId: 1
}, {
status: 'Cancelled',
userId: 2
}, {
status: 'Processing',
userId: 2
}, {
status: 'Cancelled',
userId: 3
}, {
status: 'Processing',
userId: 1
}, {
status: 'Completed',
userId: 3
}, {
status: 'Completed',
userId: 4
}];

var reviews = [{
Expand Down Expand Up @@ -256,8 +268,12 @@ var seedOrders = function() {
var creatingOrders = orders.map(function(order) {
return Order.create(order)
.then(function(response) {
return response;
});
var productId = Math.floor(Math.random() * 10 + 1)
return response.addProduct(productId);
})
.then(function(order) {
return order
})
});

return Promise.all(creatingOrders)
Expand Down

0 comments on commit 2eae8d5

Please sign in to comment.