mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
[API] Fix bugs
This commit is contained in:
parent
0b99ae0fb9
commit
d37e1d4d60
@ -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 New Issue
Block a user