NickSramcik / banki-brunch

https://banki-brunch.vercel.app
49 stars 31 forks source link

Issue #10 backend architecture: post models [WIP] #22

Closed lydiadunning closed 1 year ago

lydiadunning commented 1 year ago

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.

lydiadunning commented 1 year ago

I've updated this PR, replacing a count of upvotes and downvotes with arrays of user references.