فهرست منبع

abolish findOneAndUpdateByNsAndKey

mizozobu 6 سال پیش
والد
کامیت
c832bc8173
2فایلهای تغییر یافته به همراه5 افزوده شده و 9 حذف شده
  1. 5 1
      src/migrations/20190618055300-abolish-crowi-classic-auth.js
  2. 0 8
      src/server/models/config.js

+ 5 - 1
src/migrations/20190618055300-abolish-crowi-classic-auth.js

@@ -15,7 +15,11 @@ module.exports = {
 
     // enable passport and delete configs for crowi classic auth
     await Promise.all([
-      Config.findOneAndUpdateByNsAndKey('crowi', 'security:isEnabledPassport', true),
+      Config.findOneAndUpdate(
+        { ns: 'crowi', key: 'security:isEnabledPassport' },
+        { ns: 'crowi', key: 'security:isEnabledPassport', value: JSON.stringify(true) },
+        { upsert: true },
+      ),
       Config.deleteOne({ ns: 'crowi', key: 'google:clientId' }),
       Config.deleteOne({ ns: 'crowi', key: 'google:clientSecret' }),
     ]);

+ 0 - 8
src/server/models/config.js

@@ -188,14 +188,6 @@ module.exports = function(crowi) {
     validateCrowi();
   };
 
-  configSchema.statics.findOneAndUpdateByNsAndKey = async function(ns, key, value) {
-    return this.findOneAndUpdate(
-      { ns, key },
-      { ns, key, value: JSON.stringify(value) },
-      { upsert: true },
-    );
-  };
-
   configSchema.statics.getLocalconfig = function() {
     const env = process.env;