From cba2b9a27de4d75a90235b1a440ea39684a9b6d8 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 26 Apr 2021 14:16:05 +0100 Subject: [PATCH] Formatting. --- .../src/api/controllers/admin/configs.js | 2 +- packages/worker/src/api/routes/index.js | 2 +- .../tests/utilities/TestConfiguration.js | 116 +++++++++++------- .../worker/src/constants/templates/index.js | 6 +- packages/worker/src/utilities/templates.js | 3 +- 5 files changed, 76 insertions(+), 53 deletions(-) diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index c8d1c3d632..107c0c8fa8 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -30,7 +30,7 @@ exports.save = async function(ctx) { switch (type) { case Configs.SMTP: await email.verifyConfig(config) - break; + break } try { diff --git a/packages/worker/src/api/routes/index.js b/packages/worker/src/api/routes/index.js index 419c80e505..412d8c255a 100644 --- a/packages/worker/src/api/routes/index.js +++ b/packages/worker/src/api/routes/index.js @@ -13,5 +13,5 @@ exports.routes = [ authRoutes, appRoutes, templateRoutes, - emailRoutes + emailRoutes, ] diff --git a/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js b/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js index 7ef4fa9caa..06a0d8e548 100644 --- a/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js +++ b/packages/worker/src/api/routes/tests/utilities/TestConfiguration.js @@ -39,14 +39,18 @@ class TestConfiguration { async init() { // create a test user - await this._req({ - email: "test@test.com", - password: "test", - _id: "us_uuid1", - builder: { - global: true, - } - }, null, controllers.users.save) + await this._req( + { + email: "test@test.com", + password: "test", + _id: "us_uuid1", + builder: { + global: true, + }, + }, + null, + controllers.users.save + ) } defaultHeaders() { @@ -57,66 +61,84 @@ class TestConfiguration { const authToken = jwt.sign(user, env.JWT_SECRET) return { Accept: "application/json", - Cookie: [ - `${Cookies.Auth}=${authToken}`, - ], + Cookie: [`${Cookies.Auth}=${authToken}`], } } async deleteConfig(type) { try { - const cfg = await this._req(null,{ - type, - }, controllers.config.find) + const cfg = await this._req( + null, + { + type, + }, + controllers.config.find + ) if (cfg) { - await this._req(null, { - id: cfg._id, - rev: cfg._rev, - }, controllers.config.destroy) + await this._req( + null, + { + id: cfg._id, + rev: cfg._rev, + }, + controllers.config.destroy + ) } } catch (err) {} } async saveSettingsConfig() { await this.deleteConfig(Configs.SETTINGS) - await this._req({ - type: Configs.SETTINGS, - config: { - platformUrl: "http://localhost:10000", - logoUrl: LOGO_URL, - company: "Budibase", - } - }, null, controllers.config.save) + await this._req( + { + type: Configs.SETTINGS, + config: { + platformUrl: "http://localhost:10000", + logoUrl: LOGO_URL, + company: "Budibase", + }, + }, + null, + controllers.config.save + ) } async saveSmtpConfig() { await this.deleteConfig(Configs.SMTP) - await this._req({ - type: Configs.SMTP, - config: { - port: 12345, - host: "smtptesthost.com", - from: "testfrom@test.com", - subject: "Hello!", - } - }, null, controllers.config.save) + await this._req( + { + type: Configs.SMTP, + config: { + port: 12345, + host: "smtptesthost.com", + from: "testfrom@test.com", + subject: "Hello!", + }, + }, + null, + controllers.config.save + ) } async saveEtherealSmtpConfig() { await this.deleteConfig(Configs.SMTP) - await this._req({ - type: Configs.SMTP, - config: { - port: 587, - host: "smtp.ethereal.email", - secure: false, - auth: { - user: "don.bahringer@ethereal.email", - pass: "yCKSH8rWyUPbnhGYk9", + await this._req( + { + type: Configs.SMTP, + config: { + port: 587, + host: "smtp.ethereal.email", + secure: false, + auth: { + user: "don.bahringer@ethereal.email", + pass: "yCKSH8rWyUPbnhGYk9", + }, }, - } - }, null, controllers.config.save) + }, + null, + controllers.config.save + ) } } -module.exports = TestConfiguration \ No newline at end of file +module.exports = TestConfiguration diff --git a/packages/worker/src/constants/templates/index.js b/packages/worker/src/constants/templates/index.js index 7ddb85af47..23e5508341 100644 --- a/packages/worker/src/constants/templates/index.js +++ b/packages/worker/src/constants/templates/index.js @@ -17,10 +17,10 @@ exports.EmailTemplates = { join(__dirname, "invitation.hbs") ), [EmailTemplatePurpose.BASE]: readStaticFile(join(__dirname, "base.hbs")), - [EmailTemplatePurpose.STYLES]: readStaticFile( - join(__dirname, "style.hbs") + [EmailTemplatePurpose.STYLES]: readStaticFile(join(__dirname, "style.hbs")), + [EmailTemplatePurpose.WELCOME]: readStaticFile( + join(__dirname, "welcome.hbs") ), - [EmailTemplatePurpose.WELCOME]: readStaticFile(join(__dirname, "welcome.hbs")), } exports.addBaseTemplates = (templates, type = null) => { diff --git a/packages/worker/src/utilities/templates.js b/packages/worker/src/utilities/templates.js index 56c4340a77..8bb2ba9e95 100644 --- a/packages/worker/src/utilities/templates.js +++ b/packages/worker/src/utilities/templates.js @@ -28,7 +28,8 @@ exports.getSettingsTemplateContext = async () => { ), [TemplateBindings.RESET_URL]: checkSlashesInUrl(`${URL}/reset`), [TemplateBindings.COMPANY]: settings.company || BASE_COMPANY, - [TemplateBindings.DOCS_URL]: settings.docsUrl || "https://docs.budibase.com/", + [TemplateBindings.DOCS_URL]: + settings.docsUrl || "https://docs.budibase.com/", [TemplateBindings.LOGIN_URL]: checkSlashesInUrl(`${URL}/login`), } }