Added websocket

This commit is contained in:
Manik Maity
2024-11-13 18:37:05 +05:30
parent b3525c16dc
commit b394bbbd07
16 changed files with 308 additions and 48 deletions

View File

@@ -65,7 +65,7 @@ export async function updatePollVoteCount(pollId, optionId) {
export async function findPolls(page, limit) {
try{
const skip = (page - 1) * limit;
const polls = await PollModel.find().skip(skip).limit(limit).populate("creatorId");
const polls = await PollModel.find().sort({createdAt : -1}).skip(skip).limit(limit).populate("creatorId");
return polls;
}
catch(err){