-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(importer): Fix navigation and login after importing user data loc…
- Loading branch information
1 parent
9733af2
commit 6a1b503
Showing
3 changed files
with
67 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// A private controller to refresh the user cache after users were inserted manually into the test db. | ||
|
||
const mongodb = require('../../models/mongodb.js'); | ||
|
||
exports.controller = async function (request, getParams, response) { | ||
request.logToConsole('refresh.controller', request.method); | ||
if (request.method.toLowerCase() !== 'post') { | ||
return response.badRequest(); | ||
} | ||
if (process.appParams.mongoDbDatabase !== 'openwhyd_test') { | ||
return response.forbidden(new Error('allowed on test database only')); | ||
} | ||
try { | ||
await mongodb.initCollections({ addTestData: false }); | ||
response.renderJSON({ ok: true }); | ||
} catch (err) { | ||
response.renderJSON({ error: err.message }); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters