Skip to content

Commit

Permalink
privateRoomUpvotes
Browse files Browse the repository at this point in the history
  • Loading branch information
imdeveshshukla committed Sep 9, 2024
1 parent 561d785 commit 73df0ac
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions backend/src/controller/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,18 @@ export const getUserPolls = async (req, res) => {
},
},
createdBy: true,
room:true
},
skip:offset,
take:limit,
});
res.status(200).send(poll);
const val = poll.filter((p)=>{
return !(p.room?.privateRoom)
})
return res.status(200).send(val);
} catch (error) {
res.staus(401).send(error);
console.log(error);
return res.status(401).send(error.message);
}
};

Expand Down Expand Up @@ -232,9 +237,14 @@ export const getUserUpvotes = async (req, res) => {

data.forEach((data) => {
data.post.upvotes = data.post.upvotes.filter(
(upvote) => upvote.commentId === null
(upvote) => {
return (upvote.commentId === null)
}
);
});
data = data.filter((data)=>{
return !(data.post.room?.privateRoom);
})

res.status(200).send(data);
} catch (error) {
Expand Down

0 comments on commit 73df0ac

Please sign in to comment.