forked from FoundKeyGang/FoundKey
[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);
|
const secret = rndstr('a-zA-Z0-9', 32);
|
||||||
|
|
||||||
// Create account
|
// Create account
|
||||||
const inserted = await App.insert({
|
const app = await App.insert({
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
user_id: user._id,
|
user_id: user._id,
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -121,8 +121,6 @@ module.exports = async (params, user) =>
|
||||||
secret: secret
|
secret: secret
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = inserted.ops[0];
|
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
res(await serialize(app));
|
res(await serialize(app));
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,14 +66,12 @@ module.exports = (params) =>
|
||||||
const token = uuid.v4();
|
const token = uuid.v4();
|
||||||
|
|
||||||
// Create session token document
|
// Create session token document
|
||||||
const inserted = await AuthSess.insert({
|
const doc = await AuthSess.insert({
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
app_id: app._id,
|
app_id: app._id,
|
||||||
token: token
|
token: token
|
||||||
});
|
});
|
||||||
|
|
||||||
const doc = inserted.ops[0];
|
|
||||||
|
|
||||||
// Response
|
// Response
|
||||||
res({
|
res({
|
||||||
token: doc.token,
|
token: doc.token,
|
||||||
|
|
|
@ -59,15 +59,13 @@ module.exports = (params, user) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create folder
|
// Create folder
|
||||||
const inserted = await DriveFolder.insert({
|
const folder = await DriveFolder.insert({
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
name: name,
|
name: name,
|
||||||
parent_id: parent !== null ? parent._id : null,
|
parent_id: parent !== null ? parent._id : null,
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
});
|
});
|
||||||
|
|
||||||
const folder = inserted.ops[0];
|
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
const folderObj = await serialize(folder);
|
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(),
|
created_at: new Date(),
|
||||||
file_id: file ? file._id : undefined,
|
file_id: file ? file._id : undefined,
|
||||||
recipient_id: recipient._id,
|
recipient_id: recipient._id,
|
||||||
|
@ -86,8 +86,6 @@ module.exports = (params, user) =>
|
||||||
is_read: false
|
is_read: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const message = inserted.ops[0];
|
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
const messageObj = await serialize(message);
|
const messageObj = await serialize(message);
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,12 @@ module.exports = (params, user) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create favorite
|
// Create favorite
|
||||||
const inserted = await Favorite.insert({
|
await Favorite.insert({
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
post_id: post._id,
|
post_id: post._id,
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
});
|
});
|
||||||
|
|
||||||
const favorite = inserted.ops[0];
|
|
||||||
|
|
||||||
// Send response
|
// Send response
|
||||||
res();
|
res();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue