diff --git a/client/src/components/ListAnswer.jsx b/client/src/components/ListAnswer.jsx index caa09e1..af87e4a 100644 --- a/client/src/components/ListAnswer.jsx +++ b/client/src/components/ListAnswer.jsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import { CreationInfoTag } from 'controllers'; export default function ListAnswer({ - _id: answer_id, + answer_id, createdAt, creator, downvotes, diff --git a/client/src/components/ListQuestion.jsx b/client/src/components/ListQuestion.jsx index 237d2e1..3186f5d 100644 --- a/client/src/components/ListQuestion.jsx +++ b/client/src/components/ListQuestion.jsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import { CreationInfoTag } from 'controllers'; export default function ListQuestion({ - _id: question_id, + question_id, answers, createdAt, creator, diff --git a/client/src/components/QAComponents/Answer.jsx b/client/src/components/QAComponents/Answer.jsx index 1feb716..84fba19 100644 --- a/client/src/components/QAComponents/Answer.jsx +++ b/client/src/components/QAComponents/Answer.jsx @@ -8,7 +8,7 @@ import { getAnswerVote, updateAnswerVote } from 'services/questionsServices'; export default function Answer({ accepted, - _id: answer_id, + answer_id, comments, creator, createdAt, diff --git a/client/src/components/QAComponents/AnswerComment.jsx b/client/src/components/QAComponents/AnswerComment.jsx index 22ab00c..1193809 100644 --- a/client/src/components/QAComponents/AnswerComment.jsx +++ b/client/src/components/QAComponents/AnswerComment.jsx @@ -7,7 +7,7 @@ import { getAnswerCommentVote, updateAnswerCommentVote } from 'services/question export default function AnswerComment({ answer_id, - _id: comment_id, + comment_id, creator, createdAt, downvotes, diff --git a/client/src/components/QAComponents/Comment.jsx b/client/src/components/QAComponents/Comment.jsx index c875d4a..4667aaa 100644 --- a/client/src/components/QAComponents/Comment.jsx +++ b/client/src/components/QAComponents/Comment.jsx @@ -4,7 +4,7 @@ import { VoteControl } from 'controllers/QAControllers'; import { getCommentVote, updateCommentVote } from 'services/questionsServices'; export default function Comment({ - _id: comment_id, + comment_id, creator, createdAt, downvotes, diff --git a/client/src/components/QAComponents/Question.jsx b/client/src/components/QAComponents/Question.jsx index 3d90e09..1f319a9 100644 --- a/client/src/components/QAComponents/Question.jsx +++ b/client/src/components/QAComponents/Question.jsx @@ -14,7 +14,6 @@ const statusColor = (status) => { } export default function Question({ - _id: question_id, answers, comments, creator, @@ -24,6 +23,7 @@ export default function Question({ status, title, text, + question_id, upvotes, views }) { diff --git a/server/routes/question/GetAnswers.js b/server/routes/question/GetAnswers.js index a518eb9..2c3a270 100644 --- a/server/routes/question/GetAnswers.js +++ b/server/routes/question/GetAnswers.js @@ -1,7 +1,7 @@ const config = require('server/config.json'); const Answer = require('server/db/models/Answer'); -const Question = require('server/db/models/Question'); const { getAllAnswers } = require('server/utils/getData'); +const { getQuestion } = require('server/utils/question'); async function GetAnswers(req, res) { const { question_id } = req.params; @@ -12,7 +12,7 @@ async function GetAnswers(req, res) { if (Number(question.lastAnswerFetch) + config.answerExpires < Date.now()) { const answers = await getAllAnswers({ question_id }); return res.send({ answers }); - } else{ + } else { const answers = await Answer.find({ question_id }); return res.send({ answers }); }