[API] Fix bugs
This commit is contained in:
parent
88e5a18509
commit
e31eec542f
5 changed files with 5 additions and 15 deletions
|
@ -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));
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue