-
Notifications
You must be signed in to change notification settings - Fork 30
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
Changes from 83 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
457d02a
Merge pull request #428 from OneCommunityGlobal/development
one-community 7ee4602
Merge pull request #433 from OneCommunityGlobal/development
one-community 5bbbfaf
Merge pull request #436 from OneCommunityGlobal/development
one-community 71cb810
Merge pull request #442 from OneCommunityGlobal/development
one-community e9739e0
Merge pull request #444 from OneCommunityGlobal/development
one-community 76deba3
Revert "Backend Release to Main [0.78]"
one-community d4ae934
Merge pull request #447 from OneCommunityGlobal/revert-444-development
one-community 891d1c7
Revert "Revert "Backend Release to Main [0.78]""
one-community 5154595
Merge pull request #448 from OneCommunityGlobal/revert-447-revert-444…
one-community ee27ecb
Merge pull request #462 from OneCommunityGlobal/development
one-community 8dd903f
Merge pull request #463 from OneCommunityGlobal/development
one-community b8fc5bf
Merge pull request #469 from OneCommunityGlobal/development
one-community 91a0e66
Merge pull request #471 from OneCommunityGlobal/development
one-community af8b47e
Merge pull request #475 from OneCommunityGlobal/development
one-community 2be1879
Merge pull request #477 from OneCommunityGlobal/development
one-community 3ae790e
Merge pull request #478 from OneCommunityGlobal/development
one-community 95ac172
Merge pull request #483 from OneCommunityGlobal/development
one-community feb9c91
Merge pull request #487 from OneCommunityGlobal/development
one-community a6acd9e
Revert "Backend Release to Main [0.87]"
one-community bedfb7a
Merge pull request #488 from OneCommunityGlobal/revert-487-development
one-community db38be4
Merge pull request #491 from OneCommunityGlobal/development
one-community 94de9b9
Merge pull request #492 from OneCommunityGlobal/development
one-community dedb3a2
Merge pull request #497 from OneCommunityGlobal/development
one-community 805d377
Merge pull request #500 from OneCommunityGlobal/development
one-community bc296eb
Merge pull request #502 from OneCommunityGlobal/development
one-community 16a605c
Merge pull request #504 from OneCommunityGlobal/development
one-community 3611ace
Merge pull request #509 from OneCommunityGlobal/development
one-community b5058c5
Revert "Backend Release to Main [0.94]"
one-community bf63506
Merge pull request #510 from OneCommunityGlobal/revert-509-development
one-community c1bbc9b
Merge pull request #514 from OneCommunityGlobal/development
one-community 69415b9
Merge pull request #516 from OneCommunityGlobal/development
one-community 336c4e1
Revert "Backend Release to Main [0.96]"
one-community 23c1ecf
Merge pull request #517 from OneCommunityGlobal/revert-516-development
one-community 97abf31
Revert "Revert "Backend Release to Main [0.96]""
one-community 5cb9fa1
Merge pull request #520 from OneCommunityGlobal/revert-517-revert-516…
one-community 7a7d717
Merge pull request #521 from OneCommunityGlobal/development
one-community 3df5e48
Revert "Backend Release to Main [0.97]"
one-community 80ad009
Merge pull request #522 from OneCommunityGlobal/revert-521-development
one-community 3759010
Revert "Revert "Revert "Backend Release to Main [0.96]"""
one-community 33e075c
Merge pull request #524 from OneCommunityGlobal/revert-520-revert-517…
one-community db73657
Merge pull request #525 from OneCommunityGlobal/development
one-community f6ca186
Merge pull request #528 from OneCommunityGlobal/development
one-community 58689de
Merge pull request #535 from OneCommunityGlobal/development
one-community 59f02c7
Merge pull request #538 from OneCommunityGlobal/development
one-community 7281e5d
Merge pull request #542 from OneCommunityGlobal/development
one-community 010a0eb
Merge pull request #544 from OneCommunityGlobal/development
one-community e80c4f3
Merge pull request #548 from OneCommunityGlobal/development
one-community 2c07013
Merge pull request #554 from OneCommunityGlobal/development
one-community 1d6ff78
Merge pull request #557 from OneCommunityGlobal/development
one-community 47ec9e4
Merge pull request #558 from OneCommunityGlobal/development
one-community ffa9aa9
Merge pull request #564 from OneCommunityGlobal/development
one-community 7ecbca5
Merge pull request #568 from OneCommunityGlobal/development
one-community 2351efb
Merge pull request #573 from OneCommunityGlobal/development
one-community 0e8d59e
Merge pull request #578 from OneCommunityGlobal/development
one-community 3aab006
Merge pull request #579 from OneCommunityGlobal/development
one-community 2d9bc69
Merge pull request #581 from OneCommunityGlobal/development
one-community 8b51775
Merge pull request #584 from OneCommunityGlobal/development
one-community 539c618
Merge pull request #589 from OneCommunityGlobal/development
one-community 1a95807
Merge pull request #593 from OneCommunityGlobal/development
one-community d45e601
Merge pull request #598 from OneCommunityGlobal/development
one-community faf0cce
Merge pull request #607 from OneCommunityGlobal/development
one-community e86c747
rhea create newLessom routes and controller
RheaWu1212 f1d91c7
Merge pull request #615 from OneCommunityGlobal/development
one-community 81c38ae
Merge pull request #617 from OneCommunityGlobal/development
one-community dac03d4
Merge pull request #620 from OneCommunityGlobal/development
one-community 58a7b38
Merge pull request #625 from OneCommunityGlobal/development
one-community 2a2c39d
Merge pull request #626 from OneCommunityGlobal/development
one-community 27877a4
Merge pull request #632 from OneCommunityGlobal/development
one-community 8ca4484
Revert "Backend Release to Main [1.23]"
xaanders 20d087f
Rhea adding newLesson schema and set up db
RheaWu1212 f0fded3
Merge pull request #636 from OneCommunityGlobal/revert-632-development
one-community f28f4e6
Merge pull request #637 from OneCommunityGlobal/development
one-community 282b72b
updating controller
RheaWu1212 da3a2ce
Merge pull request #652 from OneCommunityGlobal/development
one-community 92a1d71
new lesson controller part 1
RheaWu1212 4f6e7a6
Merge pull request #658 from OneCommunityGlobal/development
one-community 8bf159d
get function using find() return empty array
RheaWu1212 8e575c6
Merge pull request #662 from OneCommunityGlobal/development
one-community 5659686
Merge pull request #669 from OneCommunityGlobal/development
one-community e079093
fix conflicts
tdkent dbf8843
fix userHelper crash
tdkent 7e054ed
update new lesson schema. update endpoint strings.
tdkent 639204b
rhea edit newlesson controller, GET function working, POST function w…
RheaWu1212 0051d81
updated controller with 201 status code and tested tags array for POS…
RheaWu1212 8150d0d
fix conflicts in routes.js
tdkent 4da0d46
update pr template to match dev branch
tdkent 7be6b64
fix conflict in routes.js
tdkent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const mongoose = require('mongoose'); | ||
|
||
const bmNewLessonController = function (BuildingNewLesson) { | ||
const bmGetLessonList = async (req, res) => { | ||
try { | ||
BuildingNewLesson | ||
.find() | ||
.populate() | ||
.then(result => res.status(200).send(result)) | ||
.catch(error => res.status(500).send(error)); | ||
} catch (err) { | ||
res.json(err); | ||
} | ||
}; | ||
const bmPostLessonList = async (req, res) => { | ||
try { | ||
const { id, title, content, author, tag, relatedProject} = req.body; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const newLesson = BuildingNewLesson.create(req.body); | ||
newLesson.save().then(result => res.status(200).send(result)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.catch(error => res.status(500).send(error)); | ||
} catch (err) { | ||
res.json(err); | ||
} | ||
}; | ||
return { bmPostLessonList, bmGetLessonList }; | ||
}; | ||
|
||
module.exports = bmNewLessonController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const mongoose = require('mongoose'); | ||
|
||
const { Schema } = mongoose; | ||
|
||
const buildingNewLesson = new Schema({ | ||
title: { type: String, required: true, maxLength: 20 }, | ||
content: { type: String, required: true, maxLength: 500 }, | ||
date: { type: Date, required: true, default: Date.now() }, | ||
author: { type: mongoose.SchemaTypes.ObjectId, ref: 'userProfile', required: true }, | ||
tags: [{ type: String, required: true, maxLength: 10 }], | ||
relatedProject: { type: mongoose.SchemaTypes.ObjectId, ref: 'buildingProject', required: true }, | ||
}); | ||
|
||
module.exports = mongoose.model('buildingNewLesson', buildingNewLesson, 'buildingNewLessons'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const express = require('express'); | ||
|
||
const routes = function (buildingNewLesson) { | ||
const NewLessonRouter = express.Router(); | ||
const controller = require('../../controllers/bmdashboard/bmNewLessonController')(buildingNewLesson); | ||
|
||
// having GET request just for testing: | ||
NewLessonRouter.route('/lessons') | ||
.get(controller.bmGetLessonList); | ||
|
||
NewLessonRouter.route('/lessons/new') | ||
.post(controller.bmPostLessonList); | ||
return NewLessonRouter; | ||
}; | ||
module.exports = routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.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'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 didgit add <controller name>
.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.
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.