|
|
@@ -5,6 +5,8 @@ import mongoose from 'mongoose';
|
|
|
|
|
|
import { getMongoUri, mongoOptions } from '~/server/util/mongoose-utils';
|
|
|
|
|
|
+import Crowi from './crowi';
|
|
|
+
|
|
|
|
|
|
const setupMongoose = async(replServer: REPLServer) => {
|
|
|
mongoose.Promise = global.Promise;
|
|
|
@@ -18,12 +20,10 @@ const setupMongoose = async(replServer: REPLServer) => {
|
|
|
};
|
|
|
|
|
|
|
|
|
-const setupModels = async(replServer: REPLServer) => { // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
|
- const models = require('./models');
|
|
|
-
|
|
|
- Object.keys(models).forEach((modelName) => {
|
|
|
- global[modelName] = models[modelName];
|
|
|
- });
|
|
|
+const setupCrowi = async(replServer: REPLServer) => {
|
|
|
+ const crowi = new Crowi();
|
|
|
+ await crowi.init();
|
|
|
+ replServer.context.crowi = crowi;
|
|
|
};
|
|
|
|
|
|
const start = async() => {
|
|
|
@@ -33,7 +33,7 @@ const start = async() => {
|
|
|
});
|
|
|
|
|
|
await setupMongoose(replServer);
|
|
|
- await setupModels(replServer);
|
|
|
+ await setupCrowi(replServer);
|
|
|
};
|
|
|
|
|
|
start();
|