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

Added Comment functionality #769

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Kirk-Esterline
Copy link

Added Comment Functionality to B-U-B

Here are the updated files

  1. Posts.ejs
  • Added an input field as well as a submit button
  • Additionally, a loop to iterate over comments tied to each post
  1. Models
  • Added a new Mongoose Schema to collect the various comments made for each post
    (Attempted to add comments to the existing posts schema, however that resulted in each comment over writing the previous comment)
  1. Controllers
  • Updated the post controller to add two functions and connect additional models
  • The comments and user models are now required
  • First is an addComment controller that creates a new comment in the database using the comments schema
  • The second is an update to the get postPost controller to find all the documents related to that post.
  1. If I had more time ...
  • A feature that is not included with this PR is adding the userName of the user who commented. Adding the the user _id of the user proved to be straightforward however cross-referencing the user from the comment with the userName proved to take more time than available.

Kirk-Esterline and others added 5 commits November 6, 2024 16:35
…a singular entity and each new comment updates the value in the mongo document. There will need to be a different schema set up for comments in the future
…ts are then collected from the database on the posts page and displayed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant