Resolve conflicts
This commit is contained in:
parent
281b388e39
commit
bfc193d8cd
308 changed files with 3045 additions and 3200 deletions
|
|
@ -14,9 +14,9 @@ import Post from '../../../models/post';
|
|||
* @return {Promise<any>}
|
||||
*/
|
||||
module.exports = (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 unreactee
|
||||
const post = await Post.findOne({
|
||||
|
|
@ -29,9 +29,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
|
||||
// if already unreacted
|
||||
const exist = await Reaction.findOne({
|
||||
post_id: post._id,
|
||||
user_id: user._id,
|
||||
deleted_at: { $exists: false }
|
||||
postId: post._id,
|
||||
userId: user._id,
|
||||
deletedAt: { $exists: false }
|
||||
});
|
||||
|
||||
if (exist === null) {
|
||||
|
|
@ -43,7 +43,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
_id: exist._id
|
||||
}, {
|
||||
$set: {
|
||||
deleted_at: new Date()
|
||||
deletedAt: new Date()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
res();
|
||||
|
||||
const dec = {};
|
||||
dec[`reaction_counts.${exist.reaction}`] = -1;
|
||||
dec[`reactionCounts.${exist.reaction}`] = -1;
|
||||
|
||||
// Decrement reactions count
|
||||
Post.update({ _id: post._id }, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue