Просмотр исходного кода

とりあえず document が save できる

takuya 3 лет назад
Родитель
Сommit
48724f52e4

+ 2 - 1
packages/app/src/server/crowi/index.js

@@ -15,6 +15,7 @@ import loggerFactory from '~/utils/logger';
 import { projectRoot } from '~/utils/project-dir-utils';
 
 import Activity from '../models/activity';
+import GrowiPlugin from '../models/growi-plugin';
 import PageRedirect from '../models/page-redirect';
 import Tag from '../models/tag';
 import UserGroup from '../models/user-group';
@@ -68,7 +69,6 @@ function Crowi() {
   this.importService = null;
   this.pluginService = null;
   this.searchService = null;
-  this.pluginService = null;
   this.socketIoService = null;
   this.pageService = null;
   this.syncPageStatusService = null;
@@ -296,6 +296,7 @@ Crowi.prototype.setupModels = async function() {
   allModels.Tag = Tag;
   allModels.UserGroup = UserGroup;
   allModels.PageRedirect = PageRedirect;
+  allModels.growiPlugin = GrowiPlugin;
 
   Object.keys(allModels).forEach((key) => {
     return this.model(key, models[key](this));

+ 0 - 1
packages/app/src/server/models/growi-plugin.ts

@@ -2,7 +2,6 @@ import {
   Schema, Model, Document,
 } from 'mongoose';
 
-
 import {
   GrowiPlugin, GrowiPluginMeta, GrowiPluginOrigin, GrowiPluginResourceType,
 } from '~/interfaces/plugin';

+ 9 - 9
packages/app/src/server/service/plugin.ts

@@ -61,15 +61,15 @@ export class PluginService {
     const metaData = this.getPluginMetaData(installedPath);
     const GrowiPlugin = mongoose.model('GrowiPlugin');
 
-    // await GrowiPlugin.insertMany({
-    //   isEnabled: true,
-    //   installedPath,
-    //   meta: {
-    //     name: metaData.name,
-    //     types: metaData.types,
-    //     author: metaData.author,
-    //   },
-    // });
+    await GrowiPlugin.insertMany({
+      isEnabled: true,
+      installedPath,
+      meta: {
+        name: metaData.name,
+        types: metaData.types,
+        author: metaData.author,
+      },
+    });
   }
 
   private getPluginMetaData(installedPath: string): GrowiPluginMeta {