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

Rhea create newLessom routes and controller #613

Merged
merged 87 commits into from
Jan 18, 2024
Merged

Conversation

RheaWu1212
Copy link
Contributor

This PR is about creating routes and controller for newLesson feature from Phase II, including GET and POST request (with local dummy data)

Or Implements # (phase 2 WBS) 6.3.2

Related PRS (if any):

n/a

Main changes explained:

Add bmNewLesson routes and controller

Note:

This is only interacting with local built-in dummy data, please feel free to test on Postman for GET/POST, will update code with mongoose once schema and db set up

…-development

Revert "Revert "Backend Release to Main [0.78]""
Copy link
Contributor

@tdkent tdkent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the merge conflicts so this branch can be tested.

};
const bmPostLessonList = async (req, res) => {
try {
const { id, title, content, author, tag, relatedProject} = req.body;
Copy link
Contributor

@tdkent tdkent Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • You don't need to deconstruct req.body if you are not using the variables. Line 17 can either be omitted or used to define a new variable such as const newDoc = req.body; const newLesson = BuildingNewLesson.create(newDoc);
  • tags is not updating because Mongo ignores fields that don't exactly match the model. Make sure to rename tag to tags.

try {
const { id, title, content, author, tag, relatedProject} = req.body;
const newLesson = BuildingNewLesson.create(req.body);
newLesson.save().then(result => res.status(200).send(result))
Copy link
Contributor

@tdkent tdkent Jan 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -17,10 +17,9 @@ To test this backend PR you need to checkout the #XXX frontend PR.
## How to test:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • did you mean to revert this file to an older version? Make sure to change it back to its current version if not.
  • you can use Source Control in VS Code or git status to check which files have been updated before committing. Changes you're not expecting or that are not relevant to your branch can be discarded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm about to ask you about that, because when I use git status, it showed up that file which I don't even know what that, and I only added my controller file when I did git add <controller name>.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you see files that you did not update after using git status I would just discard those changes. Source Control in VSC makes that really easy if you have it set up.

For now, I would just copy/paste the code for this file from the dev branch and make another commit.

Copy link
Contributor

@tdkent tdkent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look great, well done!

@tdkent tdkent merged commit 0c4f24a into development Jan 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Review Do not review or look at code without full context
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants