summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/following
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-29 14:48:47 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-29 14:48:47 +0900
commitbfc193d8cd9aecdb82d585e8b4e101deac60a5bb (patch)
tree8b4dac3a56cf703650c8207f9279028a8560a96b /src/server/api/endpoints/following
parentresolve conflict (diff)
downloadsharkey-bfc193d8cd9aecdb82d585e8b4e101deac60a5bb.tar.gz
sharkey-bfc193d8cd9aecdb82d585e8b4e101deac60a5bb.tar.bz2
sharkey-bfc193d8cd9aecdb82d585e8b4e101deac60a5bb.zip
Resolve conflicts
Diffstat (limited to 'src/server/api/endpoints/following')
-rw-r--r--src/server/api/endpoints/following/create.ts22
-rw-r--r--src/server/api/endpoints/following/delete.ts18
2 files changed, 20 insertions, 20 deletions
diff --git a/src/server/api/endpoints/following/create.ts b/src/server/api/endpoints/following/create.ts
index 767b837b35..983d8040f9 100644
--- a/src/server/api/endpoints/following/create.ts
+++ b/src/server/api/endpoints/following/create.ts
@@ -17,9 +17,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');
// 自分自身
if (user._id.equals(userId)) {
@@ -42,9 +42,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// Check if already 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) {
@@ -53,9 +53,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// Create following
await Following.insert({
- created_at: new Date(),
- follower_id: follower._id,
- followee_id: followee._id
+ createdAt: new Date(),
+ followerId: follower._id,
+ followeeId: followee._id
});
// Send response
@@ -64,14 +64,14 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
// Increment following count
User.update(follower._id, {
$inc: {
- following_count: 1
+ followingCount: 1
}
});
// Increment followers count
User.update({ _id: followee._id }, {
$inc: {
- followers_count: 1
+ followersCount: 1
}
});
diff --git a/src/server/api/endpoints/following/delete.ts b/src/server/api/endpoints/following/delete.ts
index 64b9a8cecb..25eba8b262 100644
--- a/src/server/api/endpoints/following/delete.ts
+++ b/src/server/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
}
});