From fd9d6233ede3fb1ed046d1b6fab08677f6383b2a Mon Sep 17 00:00:00 2001 From: Trumil Nasit <115455383+Trumilnasit@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:55:02 +0530 Subject: [PATCH 1/2] Update projects.js updated router.post add some condiotion to check i think which is neccesary Signed-off-by: Trumil Nasit <115455383+Trumilnasit@users.noreply.github.com> --- server/routes/projects.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/routes/projects.js b/server/routes/projects.js index 5c115b8..68a0894 100644 --- a/server/routes/projects.js +++ b/server/routes/projects.js @@ -13,7 +13,9 @@ router.get('/fetchallglobalprojects',fetchallglobalprojects); router.get('/fetchalluserprojects', fetchuser,fetchalluserprojects); // ROUTE 3 : Add a New Project : POST: "/api/projects/addproject". Login required -router.post('/addproject', fetchuser,addproject) +router.post('/addproject', fetchuser, [ + body('title', 'Title is required').not().isEmpty(), +], addproject); // ROUTE 4 : Update an Existing Project : PUT: "/api/projects/updateproject". Login required router.put('/updateproject/:id', fetchuser, updateproject); @@ -27,4 +29,4 @@ router.post('/uploadProjectImage', fetchuser, uploadProjectImage); // ROUTE 7 : Get All User Project : GET: "/api/projects/getProjectImage". Login required router.get('/getProjectImage', fetchuser, getProjectImage); -module.exports = router \ No newline at end of file +module.exports = router From da9b0d363c822a353677bb33febd8c31e1edd435 Mon Sep 17 00:00:00 2001 From: Trumil Nasit <115455383+Trumilnasit@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:59:44 +0530 Subject: [PATCH 2/2] Update Profile.js I think that this file should update something regarding to required and unique values that's why updates please assign me some labels to changes ,because it will reflect in leader-board. Signed-off-by: Trumil Nasit <115455383+Trumilnasit@users.noreply.github.com> --- server/Models/Profile.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/Models/Profile.js b/server/Models/Profile.js index 1589f73..573f4c9 100644 --- a/server/Models/Profile.js +++ b/server/Models/Profile.js @@ -6,15 +6,19 @@ const ProfileSchema = new Schema({ user: { type: mongoose.Schema.Types.ObjectId, ref: 'user', + required: true }, image: { image: String, }, name: { type: String, + required: true }, email: { type: String, + required: true, + unique: true, }, address: { type: String, @@ -33,7 +37,8 @@ const ProfileSchema = new Schema({ }, password: { type: String, + required: true, }, -}); +}, { timestamps: true }); module.exports = mongoose.model('profile', ProfileSchema);