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

Model.collection.collectionName -> Model.collection.name

Yuki Takei 6 лет назад
Родитель
Сommit
94f2778325

+ 1 - 2
src/server/routes/apiv3/import.js

@@ -53,8 +53,7 @@ module.exports = (crowi) => {
    * @return {object} document to be persisted
    */
   const overwriteParamsFn = async(Model, schema, req) => {
-    // FIXME: deprecated
-    const { collectionName } = Model.collection;
+    const collectionName = Model.collection.name;
 
     /* eslint-disable no-case-declarations */
     switch (Model.collection.collectionName) {

+ 1 - 2
src/server/routes/apiv3/mongo.js

@@ -33,8 +33,7 @@ module.exports = (crowi) => {
    *                      type: string
    */
   router.get('/collections', async(req, res) => {
-    // FIXME: deprecated
-    const collections = Object.values(crowi.models).map(model => model.collection.collectionName);
+    const collections = Object.values(crowi.models).map(model => model.collection.name);
 
     // TODO: use res.apiv3
     return res.json({

+ 1 - 2
src/server/service/export.js

@@ -100,8 +100,7 @@ class ExportService {
    * @return {string} path to zip file
    */
   async exportCollectionToJson(Model) {
-    // FIXME: deprecated
-    const { collectionName } = Model.collection;
+    const collectionName = Model.collection.name;
     const jsonFileToWrite = path.join(this.baseDir, `${collectionName}.json`);
     const writeStream = fs.createWriteStream(jsonFileToWrite, { encoding: this.growiBridgeService.getEncoding() });
     const readStream = Model.find().cursor();