Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temp/searchforpollcomments API replaced pollId body param with postId #186

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions controllers/Temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,18 +821,18 @@ class TempController {
})
}

static #searchforpollcomments = (userId, pollId) => {
static #searchforpollcomments = (userId, postId) => {
return new Promise(resolve => {
if (typeof pollId !== 'string') {
return resolve(HTTPWTHandler.badInput(`pollId must be a string. Provided type: ${typeof pollId}`))
if (typeof postId !== 'string') {
return resolve(HTTPWTHandler.badInput(`postId must be a string. Provided type: ${typeof postId}`))
}

//Check Input fields
if (pollId == "") {
return resolve(HTTPWTHandler.badInput('pollId cannot be blank'))
if (postId == "") {
return resolve(HTTPWTHandler.badInput('postId cannot be blank'))
} else {
//Find User
console.log(pollId)
console.log(postId)
function sendResponse(nameSendBackObject) {
console.log("Params Recieved")
console.log(nameSendBackObject)
Expand All @@ -845,7 +845,7 @@ class TempController {
return resolve(HTTPWTHandler.OK('Comment search successful', modifiedNameSendBackObject))
}

Poll.findOne({_id: {$eq: pollId}}).lean().then(data => {
Poll.findOne({_id: {$eq: postId}}).lean().then(data => {
if (data) {
var nameSendBackObject = [];
var comments = data.comments;
Expand Down Expand Up @@ -889,7 +889,7 @@ class TempController {
commentDownVoted: commentDownVoted
})
} else {
console.error('A comment was found on poll with id:', pollId, 'by user with id:', comments[index].commenterId, '. This user could not be found in the database. This comment should be deleted')
console.error('A comment was found on poll with id:', postId, 'by user with id:', comments[index].commenterId, '. This user could not be found in the database. This comment should be deleted')
}
})

Expand All @@ -904,7 +904,7 @@ class TempController {
}
})
.catch(err => {
console.error('An error occured while finding poll with id:', pollId, '. The error was:', err)
console.error('An error occured while finding poll with id:', postId, '. The error was:', err)
return resolve(HTTPWTHandler.serverError('An error occurred while finding poll. Please try again.'))
});
}
Expand Down Expand Up @@ -6429,8 +6429,8 @@ class TempController {
return await this.#pollpostcommentreply(userId, comment, postId, commentId)
}

static searchforpollcomments = async (userId, pollId) => {
return await this.#searchforpollcomments(userId, pollId)
static searchforpollcomments = async (userId, postId) => {
return await this.#searchforpollcomments(userId, postId)
}

static voteonpoll = async (userId, optionSelected, pollId) => {
Expand Down
2 changes: 1 addition & 1 deletion routes/Temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ router.post('/searchforpollcomments', rateLimiters['/searchforpollcomments'], (r
const worker = new Worker(workerPath, {
workerData: {
functionName: 'searchforpollcomments',
functionArgs: [req.tokenData, req.body.pollId]
functionArgs: [req.tokenData, req.body.postId]
}
})

Expand Down
Loading