Skip to content

Commit

Permalink
Updating configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik committed Mar 1, 2016
1 parent 9dea0cd commit 587809c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 8 additions & 4 deletions create.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ if (!projectId) {
}

const ds = gcloud.datastore.dataset({
projectId: config.PROJECT_ID
projectId: projectId
});

// Create a sink using a Bucket as a destination.
//const gcs = gcloud.storage({
// projectId: projectId
//});

const today = new Date();
const due = new Date()
due.setDate(today.getDate() + 30);
Expand Down Expand Up @@ -68,7 +73,7 @@ const q = ds.createQuery("Invoice")
})
.limit(1);

schedule.scheduleJob('2 * * * * *', function(){
schedule.scheduleJob('20 * * * * *', function(){
const invoice = new Invoice();
const stream = fs.createWriteStream('invoice.pdf');
ds.runQuery(q, function(err, invoices) {
Expand All @@ -80,7 +85,7 @@ schedule.scheduleJob('2 * * * * *', function(){
var entity = {
key: ds.key("Invoice"),
data: {
invoice_number: invoices.length === 0 ? 1 : ++invoices[0].data.invoice_number,
invoice_number: invoices.length === 0 ? 12 : ++invoices[0].data.invoice_number,
amount: parseInt(config.INVOICE_AMOUNT),
email: config.EMAIL_TO,
paid:"pending",
Expand Down Expand Up @@ -111,7 +116,6 @@ schedule.scheduleJob('2 * * * * *', function(){
console.log(err);
return;
}
console.log(key);
});
}
});
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "invoice-generator",
"version": "1.0.0",
"description": "",
"description": "This app will generate, schedule and email an invoice",
"repository": "https://github.com/escott-/invoice-scheduler",
"scripts": {
"watch": "webpack --watch"
"watch": "webpack --watch",
"start": "node app.js",
"deploy": "gcloud preview app deploy app.yaml"
},
"author": "",
"license": "ISC",
Expand All @@ -27,5 +30,8 @@
"devDependencies": {
"babel-preset-stage-0": "^6.5.0",
"webpack-node-externals": "^1.0.0"
},
"engines": {
"node": "5.4.1"
}
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
externals: [nodeExternals()],
output: {
path: __dirname,
filename: 'bundle.min.js'
filename: 'app.js'
},
module: {
loaders: [
Expand Down

0 comments on commit 587809c

Please sign in to comment.