From 46e85e5cc38c0df8d3dd81fb8c48fa8d17e989de Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 18 Jan 2017 06:21:22 +0900 Subject: [PATCH] [API] Fix bugs --- src/api/endpoints/drive/files.js | 5 +++-- src/api/endpoints/drive/files/find.js | 4 +++- src/api/endpoints/drive/files/show.js | 4 +++- src/api/endpoints/drive/files/update.js | 4 +++- src/api/endpoints/drive/folders.js | 2 -- src/api/endpoints/drive/stream.js | 5 +++-- src/api/serializers/drive-file.ts | 8 ++++++-- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/api/endpoints/drive/files.js b/src/api/endpoints/drive/files.js index 512d17db6a..5399461a37 100644 --- a/src/api/endpoints/drive/files.js +++ b/src/api/endpoints/drive/files.js @@ -69,8 +69,9 @@ module.exports = (params, user, app) => // Issue query const files = await DriveFile .find(query, { - data: false - }, { + fields: { + data: false + }, limit: limit, sort: sort }); diff --git a/src/api/endpoints/drive/files/find.js b/src/api/endpoints/drive/files/find.js index 74f2e4026f..a0a0e0b417 100644 --- a/src/api/endpoints/drive/files/find.js +++ b/src/api/endpoints/drive/files/find.js @@ -38,7 +38,9 @@ module.exports = (params, user) => user_id: user._id, folder_id: folder }, { - data: false + fields: { + data: false + } }); // Serialize diff --git a/src/api/endpoints/drive/files/show.js b/src/api/endpoints/drive/files/show.js index 79b07dace2..dffb6d6612 100644 --- a/src/api/endpoints/drive/files/show.js +++ b/src/api/endpoints/drive/files/show.js @@ -28,7 +28,9 @@ module.exports = (params, user) => _id: new mongo.ObjectID(fileId), user_id: user._id }, { - data: false + fields: { + data: false + } }); if (file === null) { diff --git a/src/api/endpoints/drive/files/update.js b/src/api/endpoints/drive/files/update.js index 13ec30b4fb..cc4a8af8d5 100644 --- a/src/api/endpoints/drive/files/update.js +++ b/src/api/endpoints/drive/files/update.js @@ -31,7 +31,9 @@ module.exports = (params, user) => _id: new mongo.ObjectID(fileId), user_id: user._id }, { - data: false + fields: { + data: false + } }); if (file === null) { diff --git a/src/api/endpoints/drive/folders.js b/src/api/endpoints/drive/folders.js index d2a9da2808..fd37840ff7 100644 --- a/src/api/endpoints/drive/folders.js +++ b/src/api/endpoints/drive/folders.js @@ -69,8 +69,6 @@ module.exports = (params, user, app) => // Issue query const folders = await DriveFolder .find(query, { - data: false - }, { limit: limit, sort: sort }); diff --git a/src/api/endpoints/drive/stream.js b/src/api/endpoints/drive/stream.js index 1d0cbaca2b..50c60041e8 100644 --- a/src/api/endpoints/drive/stream.js +++ b/src/api/endpoints/drive/stream.js @@ -72,8 +72,9 @@ module.exports = (params, user) => // Issue query const files = await DriveFile .find(query, { - data: false - }, { + fields: { + data: false + }, limit: limit, sort: sort }); diff --git a/src/api/serializers/drive-file.ts b/src/api/serializers/drive-file.ts index a0c410e32e..65fe7d6d26 100644 --- a/src/api/serializers/drive-file.ts +++ b/src/api/serializers/drive-file.ts @@ -33,13 +33,17 @@ export default ( _file = await DriveFile.findOne({ _id: file }, { - data: false + fields: { + data: false + } }); } else if (typeof file === 'string') { _file = await DriveFile.findOne({ _id: new mongo.ObjectID(file) }, { - data: false + fields: { + data: false + } }); } else { _file = deepcopy(file);