diff --git a/src/api/endpoints/app/create.js b/src/api/endpoints/app/create.js index 9ce98b197a..1febd9b568 100644 --- a/src/api/endpoints/app/create.js +++ b/src/api/endpoints/app/create.js @@ -109,7 +109,7 @@ module.exports = async (params, user) => const secret = rndstr('a-zA-Z0-9', 32); // Create account - const inserted = await App.insert({ + const app = await App.insert({ created_at: new Date(), user_id: user._id, name: name, @@ -121,8 +121,6 @@ module.exports = async (params, user) => secret: secret }); - const app = inserted.ops[0]; - // Response res(await serialize(app)); }); diff --git a/src/api/endpoints/auth/session/generate.js b/src/api/endpoints/auth/session/generate.js index f67209eee3..6cc124f9ec 100644 --- a/src/api/endpoints/auth/session/generate.js +++ b/src/api/endpoints/auth/session/generate.js @@ -66,14 +66,12 @@ module.exports = (params) => const token = uuid.v4(); // Create session token document - const inserted = await AuthSess.insert({ + const doc = await AuthSess.insert({ created_at: new Date(), app_id: app._id, token: token }); - const doc = inserted.ops[0]; - // Response res({ token: doc.token, diff --git a/src/api/endpoints/drive/folders/create.js b/src/api/endpoints/drive/folders/create.js index ba40d1763e..a9c0968aa6 100644 --- a/src/api/endpoints/drive/folders/create.js +++ b/src/api/endpoints/drive/folders/create.js @@ -59,15 +59,13 @@ module.exports = (params, user) => } // Create folder - const inserted = await DriveFolder.insert({ + const folder = await DriveFolder.insert({ created_at: new Date(), name: name, parent_id: parent !== null ? parent._id : null, user_id: user._id }); - const folder = inserted.ops[0]; - // Serialize const folderObj = await serialize(folder); diff --git a/src/api/endpoints/messaging/messages/create.js b/src/api/endpoints/messaging/messages/create.js index 1cd02cfc58..021ec98e04 100644 --- a/src/api/endpoints/messaging/messages/create.js +++ b/src/api/endpoints/messaging/messages/create.js @@ -77,7 +77,7 @@ module.exports = (params, user) => } // メッセージを作成 - const inserted = await Message.insert({ + const message = await Message.insert({ created_at: new Date(), file_id: file ? file._id : undefined, recipient_id: recipient._id, @@ -86,8 +86,6 @@ module.exports = (params, user) => is_read: false }); - const message = inserted.ops[0]; - // Serialize const messageObj = await serialize(message); diff --git a/src/api/endpoints/posts/favorites/create.js b/src/api/endpoints/posts/favorites/create.js index d20a523d5d..f2e29bbc39 100644 --- a/src/api/endpoints/posts/favorites/create.js +++ b/src/api/endpoints/posts/favorites/create.js @@ -43,14 +43,12 @@ module.exports = (params, user) => } // Create favorite - const inserted = await Favorite.insert({ + await Favorite.insert({ created_at: new Date(), post_id: post._id, user_id: user._id }); - const favorite = inserted.ops[0]; - // Send response res(); });