diff options
Diffstat (limited to 'src/api/endpoints/i')
| -rw-r--r-- | src/api/endpoints/i/2fa/done.ts | 8 | ||||
| -rw-r--r-- | src/api/endpoints/i/2fa/register.ts | 2 | ||||
| -rw-r--r-- | src/api/endpoints/i/2fa/unregister.ts | 4 | ||||
| -rw-r--r-- | src/api/endpoints/i/appdata/get.ts | 4 | ||||
| -rw-r--r-- | src/api/endpoints/i/appdata/set.ts | 8 | ||||
| -rw-r--r-- | src/api/endpoints/i/authorized_apps.ts | 4 | ||||
| -rw-r--r-- | src/api/endpoints/i/favorites.ts | 2 | ||||
| -rw-r--r-- | src/api/endpoints/i/notifications.ts | 12 | ||||
| -rw-r--r-- | src/api/endpoints/i/pin.ts | 10 | ||||
| -rw-r--r-- | src/api/endpoints/i/signin_history.ts | 2 | ||||
| -rw-r--r-- | src/api/endpoints/i/update.ts | 30 | ||||
| -rw-r--r-- | src/api/endpoints/i/update_client_setting.ts | 4 | ||||
| -rw-r--r-- | src/api/endpoints/i/update_home.ts | 6 | ||||
| -rw-r--r-- | src/api/endpoints/i/update_mobile_home.ts | 6 |
14 files changed, 51 insertions, 51 deletions
diff --git a/src/api/endpoints/i/2fa/done.ts b/src/api/endpoints/i/2fa/done.ts index 0f1db73829..d61ebbe6f9 100644 --- a/src/api/endpoints/i/2fa/done.ts +++ b/src/api/endpoints/i/2fa/done.ts @@ -12,12 +12,12 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { const _token = token.replace(/\s/g, ''); - if (user.two_factor_temp_secret == null) { + if (user.twoFactorTempSecret == null) { return rej('二段階認証の設定が開始されていません'); } const verified = (speakeasy as any).totp.verify({ - secret: user.two_factor_temp_secret, + secret: user.twoFactorTempSecret, encoding: 'base32', token: _token }); @@ -28,8 +28,8 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.two_factor_secret': user.two_factor_temp_secret, - 'account.two_factor_enabled': true + 'account.twoFactorSecret': user.twoFactorTempSecret, + 'account.twoFactorEnabled': true } }); diff --git a/src/api/endpoints/i/2fa/register.ts b/src/api/endpoints/i/2fa/register.ts index 24abfcdfc5..b498a2414e 100644 --- a/src/api/endpoints/i/2fa/register.ts +++ b/src/api/endpoints/i/2fa/register.ts @@ -27,7 +27,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - two_factor_temp_secret: secret.base32 + twoFactorTempSecret: secret.base32 } }); diff --git a/src/api/endpoints/i/2fa/unregister.ts b/src/api/endpoints/i/2fa/unregister.ts index c43f9ccc44..0221ecb96d 100644 --- a/src/api/endpoints/i/2fa/unregister.ts +++ b/src/api/endpoints/i/2fa/unregister.ts @@ -19,8 +19,8 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.two_factor_secret': null, - 'account.two_factor_enabled': false + 'account.twoFactorSecret': null, + 'account.twoFactorEnabled': false } }); diff --git a/src/api/endpoints/i/appdata/get.ts b/src/api/endpoints/i/appdata/get.ts index 571208d46c..0b34643f75 100644 --- a/src/api/endpoints/i/appdata/get.ts +++ b/src/api/endpoints/i/appdata/get.ts @@ -25,8 +25,8 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => { select[`data.${key}`] = true; } const appdata = await Appdata.findOne({ - app_id: app._id, - user_id: user._id + appId: app._id, + userId: user._id }, { fields: select }); diff --git a/src/api/endpoints/i/appdata/set.ts b/src/api/endpoints/i/appdata/set.ts index 2804a14cb3..1e3232ce3d 100644 --- a/src/api/endpoints/i/appdata/set.ts +++ b/src/api/endpoints/i/appdata/set.ts @@ -43,11 +43,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => { } await Appdata.update({ - app_id: app._id, - user_id: user._id + appId: app._id, + userId: user._id }, Object.assign({ - app_id: app._id, - user_id: user._id + appId: app._id, + userId: user._id }, { $set: set }), { diff --git a/src/api/endpoints/i/authorized_apps.ts b/src/api/endpoints/i/authorized_apps.ts index 40ce7a68c8..5a38d7c18f 100644 --- a/src/api/endpoints/i/authorized_apps.ts +++ b/src/api/endpoints/i/authorized_apps.ts @@ -28,7 +28,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Get tokens const tokens = await AccessToken .find({ - user_id: user._id + userId: user._id }, { limit: limit, skip: offset, @@ -39,5 +39,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Serialize res(await Promise.all(tokens.map(async token => - await pack(token.app_id)))); + await pack(token.appId)))); }); diff --git a/src/api/endpoints/i/favorites.ts b/src/api/endpoints/i/favorites.ts index eb464cf0f0..22a4399540 100644 --- a/src/api/endpoints/i/favorites.ts +++ b/src/api/endpoints/i/favorites.ts @@ -28,7 +28,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { // Get favorites const favorites = await Favorite .find({ - user_id: user._id + userId: user._id }, { limit: limit, skip: offset, diff --git a/src/api/endpoints/i/notifications.ts b/src/api/endpoints/i/notifications.ts index 688039a0dd..e3447c17ec 100644 --- a/src/api/endpoints/i/notifications.ts +++ b/src/api/endpoints/i/notifications.ts @@ -47,15 +47,15 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } const mute = await Mute.find({ - muter_id: user._id, - deleted_at: { $exists: false } + muterId: user._id, + deletedAt: { $exists: false } }); const query = { - notifiee_id: user._id, + notifieeId: user._id, $and: [{ - notifier_id: { - $nin: mute.map(m => m.mutee_id) + notifierId: { + $nin: mute.map(m => m.muteeId) } }] } as any; @@ -69,7 +69,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { const followingIds = await getFriends(user._id); query.$and.push({ - notifier_id: { + notifierId: { $in: followingIds } }); diff --git a/src/api/endpoints/i/pin.ts b/src/api/endpoints/i/pin.ts index ff546fc2bd..886a3edeb5 100644 --- a/src/api/endpoints/i/pin.ts +++ b/src/api/endpoints/i/pin.ts @@ -14,14 +14,14 @@ import { pack } from '../../models/user'; * @return {Promise<any>} */ module.exports = async (params, user) => new Promise(async (res, rej) => { - // Get 'post_id' parameter - const [postId, postIdErr] = $(params.post_id).id().$; - if (postIdErr) return rej('invalid post_id param'); + // Get 'postId' parameter + const [postId, postIdErr] = $(params.postId).id().$; + if (postIdErr) return rej('invalid postId param'); // Fetch pinee const post = await Post.findOne({ _id: postId, - user_id: user._id + userId: user._id }); if (post === null) { @@ -30,7 +30,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - pinned_post_id: post._id + pinnedPostId: post._id } }); diff --git a/src/api/endpoints/i/signin_history.ts b/src/api/endpoints/i/signin_history.ts index 859e81653d..5b794d0a4b 100644 --- a/src/api/endpoints/i/signin_history.ts +++ b/src/api/endpoints/i/signin_history.ts @@ -30,7 +30,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { } const query = { - user_id: user._id + userId: user._id } as any; const sort = { diff --git a/src/api/endpoints/i/update.ts b/src/api/endpoints/i/update.ts index db8a3f25bd..6645751871 100644 --- a/src/api/endpoints/i/update.ts +++ b/src/api/endpoints/i/update.ts @@ -36,20 +36,20 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re if (birthdayErr) return rej('invalid birthday param'); if (birthday !== undefined) user.account.profile.birthday = birthday; - // Get 'avatar_id' parameter - const [avatarId, avatarIdErr] = $(params.avatar_id).optional.id().$; - if (avatarIdErr) return rej('invalid avatar_id param'); - if (avatarId) user.avatar_id = avatarId; + // Get 'avatarId' parameter + const [avatarId, avatarIdErr] = $(params.avatarId).optional.id().$; + if (avatarIdErr) return rej('invalid avatarId param'); + if (avatarId) user.avatarId = avatarId; - // Get 'banner_id' parameter - const [bannerId, bannerIdErr] = $(params.banner_id).optional.id().$; - if (bannerIdErr) return rej('invalid banner_id param'); - if (bannerId) user.banner_id = bannerId; + // Get 'bannerId' parameter + const [bannerId, bannerIdErr] = $(params.bannerId).optional.id().$; + if (bannerIdErr) return rej('invalid bannerId param'); + if (bannerId) user.bannerId = bannerId; - // Get 'is_bot' parameter - const [isBot, isBotErr] = $(params.is_bot).optional.boolean().$; - if (isBotErr) return rej('invalid is_bot param'); - if (isBot != null) user.account.is_bot = isBot; + // Get 'isBot' parameter + const [isBot, isBotErr] = $(params.isBot).optional.boolean().$; + if (isBotErr) return rej('invalid isBot param'); + if (isBot != null) user.account.isBot = isBot; // Get 'auto_watch' parameter const [autoWatch, autoWatchErr] = $(params.auto_watch).optional.boolean().$; @@ -60,10 +60,10 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re $set: { name: user.name, description: user.description, - avatar_id: user.avatar_id, - banner_id: user.banner_id, + avatarId: user.avatarId, + bannerId: user.bannerId, 'account.profile': user.account.profile, - 'account.is_bot': user.account.is_bot, + 'account.isBot': user.account.isBot, 'account.settings': user.account.settings } }); diff --git a/src/api/endpoints/i/update_client_setting.ts b/src/api/endpoints/i/update_client_setting.ts index c772ed5dc3..a0bef5e595 100644 --- a/src/api/endpoints/i/update_client_setting.ts +++ b/src/api/endpoints/i/update_client_setting.ts @@ -22,14 +22,14 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (valueErr) return rej('invalid value param'); const x = {}; - x[`account.client_settings.${name}`] = value; + x[`account.clientSettings.${name}`] = value; await User.update(user._id, { $set: x }); // Serialize - user.account.client_settings[name] = value; + user.account.clientSettings[name] = value; const iObj = await pack(user, user, { detail: true, includeSecrets: true diff --git a/src/api/endpoints/i/update_home.ts b/src/api/endpoints/i/update_home.ts index 9ce44e25ee..151c3e205f 100644 --- a/src/api/endpoints/i/update_home.ts +++ b/src/api/endpoints/i/update_home.ts @@ -26,7 +26,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (home) { await User.update(user._id, { $set: { - 'account.client_settings.home': home + 'account.clientSettings.home': home } }); @@ -38,7 +38,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { } else { if (id == null && data == null) return rej('you need to set id and data params if home param unset'); - const _home = user.account.client_settings.home; + const _home = user.account.clientSettings.home; const widget = _home.find(w => w.id == id); if (widget == null) return rej('widget not found'); @@ -47,7 +47,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.client_settings.home': _home + 'account.clientSettings.home': _home } }); diff --git a/src/api/endpoints/i/update_mobile_home.ts b/src/api/endpoints/i/update_mobile_home.ts index 1daddf42b9..a8436b940f 100644 --- a/src/api/endpoints/i/update_mobile_home.ts +++ b/src/api/endpoints/i/update_mobile_home.ts @@ -25,7 +25,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { if (home) { await User.update(user._id, { $set: { - 'account.client_settings.mobile_home': home + 'account.clientSettings.mobile_home': home } }); @@ -37,7 +37,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { } else { if (id == null && data == null) return rej('you need to set id and data params if home param unset'); - const _home = user.account.client_settings.mobile_home || []; + const _home = user.account.clientSettings.mobile_home || []; const widget = _home.find(w => w.id == id); if (widget == null) return rej('widget not found'); @@ -46,7 +46,7 @@ module.exports = async (params, user) => new Promise(async (res, rej) => { await User.update(user._id, { $set: { - 'account.client_settings.mobile_home': _home + 'account.clientSettings.mobile_home': _home } }); |