Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
FROM pollOptions
WHERE pollOptions.pollId = (
SELECT pollOptions.pollId
FROM pollOptions
WHERE pollOptions.id = ${db.sequelize.escape(req.body.pollOptionId)}
))
`)
}
}
})
if (foundVote === null) {
await db.models.vote.create({
voterIp: req.ip,
pollOptionId: req.body.pollOptionId
})
var pusher = new Pusher({
appId: process.env.PUSHER_APP_ID,
key: process.env.PUSHER_APP_KEY,
secret: process.env.PUSHER_APP_SECRET
})
const foundPoll = await db.models.poll.findOne({
where: {
id: req.body.pollId
},
group: ['pollOptions.id'],
order: [[db.sequelize.literal('`pollOptions.voteCount`'), 'ASC']],
attributes: ['question'],
include: {
model: db.models.pollOption,
attributes: [
['id', 'optionId'],
'text',