Resolve conflicts
This commit is contained in:
parent
281b388e39
commit
bfc193d8cd
308 changed files with 3045 additions and 3200 deletions
|
|
@ -13,9 +13,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');
|
||||
|
||||
// Get favoritee
|
||||
const post = await Post.findOne({
|
||||
|
|
@ -28,8 +28,8 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
|
||||
// if already favorited
|
||||
const exist = await Favorite.findOne({
|
||||
post_id: post._id,
|
||||
user_id: user._id
|
||||
postId: post._id,
|
||||
userId: user._id
|
||||
});
|
||||
|
||||
if (exist === null) {
|
||||
|
|
@ -37,7 +37,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
}
|
||||
|
||||
// Delete favorite
|
||||
await Favorite.deleteOne({
|
||||
await Favorite.remove({
|
||||
_id: exist._id
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue