This is a model for questions and answers designed to allow for upvoting, downvoting, and leaving comments.
This contribution could be split into multiple files. Since I used nesting and inheritance, and I want anyone generally familiar with mongoose to understand what's going on in the code, I included many comments, including a few links.
The code has been linted but not tested.
I made a lot of assumptions writing this code (voting on questions, commenting, users can add questions and answers, questions can be deactivated). It would probably be best to confirm that this approach makes sense for Banki Brunch before merging these changes.
This is a model for questions and answers designed to allow for upvoting, downvoting, and leaving comments. This contribution could be split into multiple files. Since I used nesting and inheritance, and I want anyone generally familiar with mongoose to understand what's going on in the code, I included many comments, including a few links. The code has been linted but not tested.
I made a lot of assumptions writing this code (voting on questions, commenting, users can add questions and answers, questions can be deactivated). It would probably be best to confirm that this approach makes sense for Banki Brunch before merging these changes.