From f607a318a453dced96100cdbaffe1f47adbaaabd Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Tue, 8 Mar 2022 10:17:33 -0500 Subject: [PATCH] fix: create org v2 --- src/config/config.cjs | 7 ++++++- src/controllers/organization.controller.js | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/config.cjs b/src/config/config.cjs index aa250dd4..687f1dc1 100644 --- a/src/config/config.cjs +++ b/src/config/config.cjs @@ -8,7 +8,7 @@ const fs = require('fs'); // and then changing the CWD to the actual ClimateWarehouse directory allows it to run launched from the UI or in // from $HOME or the actual directory in terminal try { - fs.accessSync('./ClimateWarehouse/data.sqlite3') + fs.accessSync('./ClimateWarehouse/data.sqlite3'); process.chdir('./ClimateWarehouse'); } catch (err) {} @@ -18,6 +18,11 @@ module.exports = { storage: './data.sqlite3', logging: false, }, + simulator: { + dialect: 'sqlite', + storage: './simulator.sqlite3', + logging: false, + }, test: { dialect: 'sqlite', storage: './test.sqlite3', diff --git a/src/controllers/organization.controller.js b/src/controllers/organization.controller.js index a3d29c4b..dbceb9ea 100644 --- a/src/controllers/organization.controller.js +++ b/src/controllers/organization.controller.js @@ -21,7 +21,7 @@ export const createV2 = async (req, res) => { const myOrganization = await Organization.getHomeOrg(); - if (!myOrganization) { + if (myOrganization) { return res.json({ message: 'Your organization already exists.', orgId: myOrganization.orgUid, @@ -37,6 +37,7 @@ export const createV2 = async (req, res) => { }); } } catch (error) { + console.trace(error); res.status(400).json({ message: 'Error initiating your organization', error: error.message,