From 07eace80a70a2521fd8c5c13cf52d33a36c61ed0 Mon Sep 17 00:00:00 2001 From: colby allen Date: Thu, 11 Jul 2019 15:01:48 -0400 Subject: [PATCH 01/10] logging the response --- skills/projectCommand.js | 1 + 1 file changed, 1 insertion(+) diff --git a/skills/projectCommand.js b/skills/projectCommand.js index c837236..aae029a 100644 --- a/skills/projectCommand.js +++ b/skills/projectCommand.js @@ -9,6 +9,7 @@ module.exports = (controller) => { const action = Actions.fromMessageText(message.text); // eslint-disable-next-line no-undef const response = await action.execute(message.text, { project, driver: projectBot.dbDriver }); + console.log(response); await response.sendToBot(bot, message); } }); From 0d44cf8d67f5a4adb346f1d3550466fefe7cbddd Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 12:53:26 -0400 Subject: [PATCH 02/10] deleting await statement --- skills/projectCommand.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/skills/projectCommand.js b/skills/projectCommand.js index aae029a..9c9c4f1 100644 --- a/skills/projectCommand.js +++ b/skills/projectCommand.js @@ -9,8 +9,7 @@ module.exports = (controller) => { const action = Actions.fromMessageText(message.text); // eslint-disable-next-line no-undef const response = await action.execute(message.text, { project, driver: projectBot.dbDriver }); - console.log(response); - await response.sendToBot(bot, message); + response.sendToBot(bot, message); } }); }; From e471a783068a9698bedfb4f8c15f16ccd18fc13e Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 13:02:53 -0400 Subject: [PATCH 03/10] adding the await statement back --- skills/projectCommand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/projectCommand.js b/skills/projectCommand.js index 9c9c4f1..c837236 100644 --- a/skills/projectCommand.js +++ b/skills/projectCommand.js @@ -9,7 +9,7 @@ module.exports = (controller) => { const action = Actions.fromMessageText(message.text); // eslint-disable-next-line no-undef const response = await action.execute(message.text, { project, driver: projectBot.dbDriver }); - response.sendToBot(bot, message); + await response.sendToBot(bot, message); } }); }; From 39298f02809d3a37bd81f368656382d906c24f38 Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 14:01:09 -0400 Subject: [PATCH 04/10] not querying --- lib/actions/addLinkToProjectAction.js | 5 ++--- lib/actions/projectOverviewAction.js | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/actions/addLinkToProjectAction.js b/lib/actions/addLinkToProjectAction.js index eb39cc7..0ff6bba 100644 --- a/lib/actions/addLinkToProjectAction.js +++ b/lib/actions/addLinkToProjectAction.js @@ -27,10 +27,9 @@ class AddLinkToProjectAction { const paramsObj = this.parseParams(params); // eslint-disable-next-line new-cap const projectLink = new this.projectLink(context.project, paramsObj.label, paramsObj.link); - await projectLink.save(context.driver); + // await projectLink.save(context.driver); // eslint-disable-next-line new-cap - const response = new AddLinkToProjectResponse(paramsObj.label, paramsObj.link); - return response; + return new AddLinkToProjectResponse(paramsObj.label, paramsObj.link); } } diff --git a/lib/actions/projectOverviewAction.js b/lib/actions/projectOverviewAction.js index 2a1bb3c..b576b1c 100644 --- a/lib/actions/projectOverviewAction.js +++ b/lib/actions/projectOverviewAction.js @@ -5,8 +5,10 @@ class ProjectOverviewAction { // eslint-disable-next-line class-methods-use-this async execute(params, context) { // eslint-disable-next-line new-cap - const projectLinks = await ProjectLink.findByProject(context.project, context.driver); - return new ProjectOverviewResponse(projectLinks); + const projectLinks = 'overview'; + // await ProjectLink.findByProject(context.project, context.driver); + return projectLinks; + // new ProjectOverviewResponse(projectLinks); } } From 070297e4928993c250fbe5f1da51d770cbae4b70 Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 14:18:10 -0400 Subject: [PATCH 05/10] chaking bot json --- skills/projectCommand.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skills/projectCommand.js b/skills/projectCommand.js index c837236..6d7c08e 100644 --- a/skills/projectCommand.js +++ b/skills/projectCommand.js @@ -3,6 +3,8 @@ const Actions = require('../lib/actions/actions.js'); module.exports = (controller) => { controller.on('slash_command', async (bot, message) => { + console.log('bot', bot); + console.log('message', message); if (message.command === '/project') { /* eslint-disable-next-line no-unused-vars */ const project = await Project.findByChannel(message.channel_id); From 30f82d3f872dfad76e1d30b9d2165d3246e12c45 Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 14:24:51 -0400 Subject: [PATCH 06/10] checking out bot --- lib/actions/addLinkToProjectAction.js | 5 +++-- lib/actions/projectOverviewAction.js | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/actions/addLinkToProjectAction.js b/lib/actions/addLinkToProjectAction.js index 0ff6bba..eb39cc7 100644 --- a/lib/actions/addLinkToProjectAction.js +++ b/lib/actions/addLinkToProjectAction.js @@ -27,9 +27,10 @@ class AddLinkToProjectAction { const paramsObj = this.parseParams(params); // eslint-disable-next-line new-cap const projectLink = new this.projectLink(context.project, paramsObj.label, paramsObj.link); - // await projectLink.save(context.driver); + await projectLink.save(context.driver); // eslint-disable-next-line new-cap - return new AddLinkToProjectResponse(paramsObj.label, paramsObj.link); + const response = new AddLinkToProjectResponse(paramsObj.label, paramsObj.link); + return response; } } diff --git a/lib/actions/projectOverviewAction.js b/lib/actions/projectOverviewAction.js index b576b1c..2a1bb3c 100644 --- a/lib/actions/projectOverviewAction.js +++ b/lib/actions/projectOverviewAction.js @@ -5,10 +5,8 @@ class ProjectOverviewAction { // eslint-disable-next-line class-methods-use-this async execute(params, context) { // eslint-disable-next-line new-cap - const projectLinks = 'overview'; - // await ProjectLink.findByProject(context.project, context.driver); - return projectLinks; - // new ProjectOverviewResponse(projectLinks); + const projectLinks = await ProjectLink.findByProject(context.project, context.driver); + return new ProjectOverviewResponse(projectLinks); } } From 7319d47029a65f6e5789f68f9acac7cb1f1fe06b Mon Sep 17 00:00:00 2001 From: colby allen Date: Fri, 12 Jul 2019 15:48:36 -0400 Subject: [PATCH 07/10] console req --- components/routes/incoming_webhooks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components/routes/incoming_webhooks.js b/components/routes/incoming_webhooks.js index d290962..427ebb1 100644 --- a/components/routes/incoming_webhooks.js +++ b/components/routes/incoming_webhooks.js @@ -4,6 +4,7 @@ module.exports = function(webserver, controller) { debug('Configured /slack/receive url'); webserver.post('/slack/receive', function(req, res) { + console.log('Request', req) // NOTE: we should enforce the token check here From 1bcc89a4568214e5826007272a9248e63d148acd Mon Sep 17 00:00:00 2001 From: colby allen Date: Wed, 17 Jul 2019 14:55:25 -0400 Subject: [PATCH 08/10] removing logs --- skills/projectCommand.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/skills/projectCommand.js b/skills/projectCommand.js index 6d7c08e..c837236 100644 --- a/skills/projectCommand.js +++ b/skills/projectCommand.js @@ -3,8 +3,6 @@ const Actions = require('../lib/actions/actions.js'); module.exports = (controller) => { controller.on('slash_command', async (bot, message) => { - console.log('bot', bot); - console.log('message', message); if (message.command === '/project') { /* eslint-disable-next-line no-unused-vars */ const project = await Project.findByChannel(message.channel_id); From 1ad55f12e4595a73a37c79c3f9621ed6c984bf85 Mon Sep 17 00:00:00 2001 From: colby allen Date: Wed, 17 Jul 2019 17:08:01 -0400 Subject: [PATCH 09/10] acquiretimeout --- knexfile.js | 3 +++ package.json | 2 +- test/addLinkToProjectAction.test.js | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/knexfile.js b/knexfile.js index 150efa2..76bf339 100644 --- a/knexfile.js +++ b/knexfile.js @@ -13,11 +13,14 @@ if (process.env.NODE_ENV !== 'production') { password: process.env.DBPASSWORD, host: process.env.DBHOST, }, + pool: { min: 0, max: 10 }, + acquireConnectionTimeout: 5000, }; } else { connection = { client: 'mysql', connection: process.env.CLEARDB_DATABASE_URL, + acquireConnectionTimeout: 5000, }; } diff --git a/package.json b/package.json index e8652fd..d3d5cec 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "migrate": "knex migrate:latest", "rollback": "knex migrate:rollback", "test": "npm run mocha && npm run eslint", - "mocha": "mocha 'test/**/*.js'", + "mocha": "mocha --exit 'test/**/*.js'", "eslint": "eslint 'lib/**/*.js' 'skills/**/*.js' 'test/**/*.js'" }, "nodemonConfig": { diff --git a/test/addLinkToProjectAction.test.js b/test/addLinkToProjectAction.test.js index 0f19271..36ad29a 100644 --- a/test/addLinkToProjectAction.test.js +++ b/test/addLinkToProjectAction.test.js @@ -12,7 +12,12 @@ const AddLinkToProjectAction = require('../lib/actions/addLinkToProjectAction'); const Project = require('../lib/project'); const SQLDriver = require('../lib/dbDriver/mysql'); -describe('Add Link to Project Action', () => { +describe('Add Link to Project Action', (done) => { + // after(() => { + // console.log('destroying'); + // knex.destroy().then(() => done); + // }); + it('creates a ProjectLink', async () => { let projectLinkProjectArg; let projectLinkLabelArg; From dd8e99341eef0c728191eb950cd2d7a9e5975c05 Mon Sep 17 00:00:00 2001 From: colby allen Date: Thu, 18 Jul 2019 09:09:19 -0400 Subject: [PATCH 10/10] delete after each statement --- test/addLinkToProjectAction.test.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/addLinkToProjectAction.test.js b/test/addLinkToProjectAction.test.js index 36ad29a..0f19271 100644 --- a/test/addLinkToProjectAction.test.js +++ b/test/addLinkToProjectAction.test.js @@ -12,12 +12,7 @@ const AddLinkToProjectAction = require('../lib/actions/addLinkToProjectAction'); const Project = require('../lib/project'); const SQLDriver = require('../lib/dbDriver/mysql'); -describe('Add Link to Project Action', (done) => { - // after(() => { - // console.log('destroying'); - // knex.destroy().then(() => done); - // }); - +describe('Add Link to Project Action', () => { it('creates a ProjectLink', async () => { let projectLinkProjectArg; let projectLinkLabelArg;