summaryrefslogtreecommitdiff
path: root/src/api/endpoints/following/delete.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-03-28 17:05:36 +0900
committerGitHub <noreply@github.com>2018-03-28 17:05:36 +0900
commit46e530ef41bb640cfa66438e888d1ecd6f90f6bb (patch)
treea23eefae5e437ad6adc7dfe190daba81138aa70b /src/api/endpoints/following/delete.ts
parent#1294 (diff)
parentoops (diff)
downloadsharkey-46e530ef41bb640cfa66438e888d1ecd6f90f6bb.tar.gz
sharkey-46e530ef41bb640cfa66438e888d1ecd6f90f6bb.tar.bz2
sharkey-46e530ef41bb640cfa66438e888d1ecd6f90f6bb.zip
Merge pull request #1324 from syuilo/#1288-2
snake_case を camelCase にするなどした
Diffstat (limited to 'src/api/endpoints/following/delete.ts')
-rw-r--r--src/api/endpoints/following/delete.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/api/endpoints/following/delete.ts b/src/api/endpoints/following/delete.ts
index 64b9a8cecb..25eba8b262 100644
--- a/src/api/endpoints/following/delete.ts
+++ b/src/api/endpoints/following/delete.ts
@@ -16,9 +16,9 @@ import event from '../../event';
module.exports = (params, user) => new Promise(async (res, rej) => {
const follower = user;
- // Get 'user_id' parameter
- const [userId, userIdErr] = $(params.user_id).id().$;
- if (userIdErr) return rej('invalid user_id param');
+ // Get 'userId' parameter
+ const [userId, userIdErr] = $(params.userId).id().$;
+ if (userIdErr) return rej('invalid userId param');
// Check if the followee is yourself
if (user._id.equals(userId)) {
@@ -41,9 +41,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// Check not following
const exist = await Following.findOne({
- follower_id: follower._id,
- followee_id: followee._id,
- deleted_at: { $exists: false }
+ followerId: follower._id,
+ followeeId: followee._id,
+ deletedAt: { $exists: false }
});
if (exist === null) {
@@ -55,7 +55,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
_id: exist._id
}, {
$set: {
- deleted_at: new Date()
+ deletedAt: new Date()
}
});
@@ -65,14 +65,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// Decrement following count
User.update({ _id: follower._id }, {
$inc: {
- following_count: -1
+ followingCount: -1
}
});
// Decrement followers count
User.update({ _id: followee._id }, {
$inc: {
- followers_count: -1
+ followersCount: -1
}
});