-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implement post request for comment creation #60
Implement post request for comment creation #60
Conversation
…ndling for bad input/syntax.
…ected returned status code to be 201 Created when a comment is successfully created.
…ment-post-request-for-comment-creation
…follow the new comment schema.
…ment-post-request-for-comment-creation
…l to false and thereby making the test to perceive the boolean check as failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left comments with suggestion where I think changes are required.
There is already an existing route for posting a new comment to an existing forum post:
app.route('/api/v1/posts/:id/comments')
.get(forum.commentViewById)
.post(forum.commentGiveById);
app.route('/api/v1/posts/:id/comments/:id')
.patch(forum.commentUpdateById);
This can be found in: routes/forum.server.routes.js
There are dummy functions with TODO comments already existing in the forum.controller for implementing forum post comment features.
In terms of cohesion I think it would be better to keep all the comment functionality in the forum controller and model files. Keep in mind making new comment files would create more coupling than just between forum post and forum comment. A forum has posts and posts have comments. A forum user makes forum posts and comments to forum posts. If we remove forum posts (hypothetically), comments could still remain but without posts to comment to.
I have reassigned myself to this pull request because I am responsible for merging the pull request when it is approved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside for the requested changes it looks very good!
The PR includes changes that are not necessarily required for this feature.
For this feature, no new files should be required in the following directories:
routes/
controllers/
models/
For this feature, no changes should be required in the following files:
models/db.server.model.js
config/express.server.config.js
It's better to have high cohesion and low coupling. Making new files for comments increases coupling and reduces cohesion.
Description
Implement HTTP POST request for creating new comments for a forum post.
Completed by both @hiin3d55 and @R055A .
Related Issue
N/A
Solves
Implement post request for creating a comment on a forum post #17
Type of change
How Has This Been Tested?
Checklist:
For more information, refer to the Contributing Guidelines and Code of Conduct links at the bottom of this page.