Skip to content

Commit 06f464f

Browse files
authored
Merge branch 'development' into development
2 parents f36b71f + 4c29c6e commit 06f464f

File tree

20 files changed

+1748
-238
lines changed

20 files changed

+1748
-238
lines changed

.DS_Store

8 KB
Binary file not shown.

PR_Template.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
### **Problem**
2-
_Describe the problem you are trying to achieve. Please provide in detail_
3-
2+
new and robust schema needed for users, project and notification.
43
### **Issue this PR referred to**
5-
_Please refer to the issue this PR is referred to write in this format `Fixes #<issue number>`, Refer to this [link](https://help.github.com/en/articles/closing-issues-using-keywords) for more details_
4+
Fixes issue number 146, Refer to this [link](https://github.com/codeuino/Social-Platform-Donut/issues/146) for more details_
65

76
### **Solution of problem**
8-
_How did you solve this problem? Please provide in detail_
7+
I added some new fields to the schema of the user.js, project.js and notification.js
98

10-
### **Before and After Screenshots**
11-
_**Before** [How was it earlier, add it here]_
9+
# in notification.js
10+
- added field shortinfo(type:string) for short description about notification.
11+
# in user.js
12+
- added field website(type:string) for any personal website user has.
13+
- added followerList and followingList(type:\[number]) to include the name of all the followers and following.
14+
- add field status(type:string) for status of user.
15+
- added field school(type:string) for user's schoolname.
16+
- added field collegeTimeperiod and schoolTimeperiod (type:\[Date]) for time period of college and school respectively.
17+
- added field blockedUser(type:\[Number]) for keeping track of all users blocked.
18+
# in project.js
19+
- added field endAt(type:\[Date]) as to when is the deadline.
20+
- added field shortDesc(type:String) for one liner description of the project.
21+
- added field linkedUser(type:\[Number]) for all the people linked with project.
1222

13-
_**After** [How it looks now, add it here]_
23+
### **Before and After Screenshots**
1424

1525
### **Type of Change**
16-
- [ ] Bug fix
17-
- [ ] New Feature
18-
- [ ] Development of UI/UX prototypes
19-
- [ ] Small refactor
20-
- [ ] Change in Documentation
26+
- Small refactor
2127

2228
### **Checklist**
23-
- [ ] My code follow the same style as the codebase
24-
- [ ] My Code changed required change in documentation
25-
- [ ] I have updated the Readme accordingly
26-
- [ ] I made PR within **development branch only**
29+
- My code follow the same style as the codebase
30+
- My Code changed required change in documentation
31+
- I have updated the Readme accordingly
32+
- I made PR within **development branch only**

config/credential.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
module.exports = {
2-
oauth: {
3-
clientID: "192695093229-kf95jtdv1jge25d86ak99e68dkrpu33o.apps.googleusercontent.com",
4-
clientSecret: "rXvfxBahDlJF1ORk7y660XM8"
5-
},
6-
database: 'mongodb://localhost:27017/donut1',
7-
github: {
8-
clientID: 'c9afdb238ed98b213912',
9-
clientSecret: '3031efea8badea1381da682fd5f21e88e5a15d2f'
10-
},
11-
facebook: {
12-
clientID: '383717979035587',
13-
clientSecret: '82bd80d286ef6e45606da6d53a97efbc'
14-
}
15-
}
1+
module.exports = {
2+
oauth: {
3+
clientID: "192695093229-kf95jtdv1jge25d86ak99e68dkrpu33o.apps.googleusercontent.com",
4+
clientSecret: "rXvfxBahDlJF1ORk7y660XM8"
5+
},
6+
database: 'mongodb://localhost:27017/donut1',
7+
github: {
8+
clientID: 'c9afdb238ed98b213912',
9+
clientSecret: '3031efea8badea1381da682fd5f21e88e5a15d2f'
10+
},
11+
facebook: {
12+
clientID: '383717979035587',
13+
clientSecret: '82bd80d286ef6e45606da6d53a97efbc'
14+
}
15+
}

config/local.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const passport = require('passport');
22
const LocalStrategy = require('passport-local');
33
const User = require('../schema/user');
4+
const path=require('path')
45

56
passport.serializeUser(function(user, done) {
67
done(null, user.id);
@@ -28,7 +29,14 @@ passport.use(
2829
if (user) {
2930
return done(null, false);
3031
}
31-
32+
33+
upload(req,res,(err)=>{
34+
if(err){
35+
let img="oldMan.jpeg"
36+
}else{
37+
let img=req.file.filename
38+
}
39+
})
3240
let newUser = new User();
3341
newUser.fname = req.body.fname;
3442
newUser.lname = req.body.lname;
@@ -41,6 +49,7 @@ passport.use(
4149
newUser.following = 0;
4250
newUser.status = 'idle';
4351
newUser.Eid = newUser.id;
52+
newUser.profilePicture=img;
4453

4554
newUser.save(err => {
4655
if (err) {

controller/profile.controller.js

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const user = require('../schema/user.js');
22
const proj = require('../schema/project.js');
33
const expressValidator = require('express-validator');
4+
const { check, validationResult } = require('express-validator/check');
45

56
module.exports = {
67
SubmitprojectForm:function(req,res){
@@ -108,19 +109,48 @@ module.exports = {
108109
updateDetails: function(req, res) {
109110
user.findOne({ Eid: req.user.Eid }).then(function(data) {
110111
// prettier-ignore
111-
(data.fname = req.body.fname),
112-
(data.lname = req.body.lname),
113-
(data.bio = req.body.bio),
114-
(data.college = req.body.college),
115-
(data.email = req.body.email),
116-
(data.github = req.body.githubUrl),
117-
(data.linkedin = req.body.linkedinUrl),
118-
(data.city = req.body.city),
119-
(data.country = req.body.country),
120-
(data.lang = req.body.languages),
121-
(data.facebook = req.body.facebookUrl);
122-
data.save();
123-
res.send('success');
112+
req.check('fname','First name is required !').notEmpty();
113+
req.check('lname','Last name is required !').notEmpty();
114+
req.check('bio','Bio is required !').notEmpty();
115+
req.check('college','College name is required !').notEmpty();
116+
req.check('email','Email is required !').isEmail();
117+
req.check('githubUrl','Github url is required !').isURL();
118+
req.check('linkedinUrl','Linkedin url is required !').isURL();
119+
req.check('facebookUrl','Facebook url is required !').isURL();
120+
req.check('city','City name is required !').notEmpty();
121+
req.check('country','Country name is required !').notEmpty();
122+
req.check('languages','Language is required !').notEmpty();
123+
req.getValidationResult(req)
124+
.then((result)=>{
125+
if(result.isEmpty() === true){
126+
result.array().forEach((error)=>{
127+
console.log(error.msg);
128+
res.redirect('/profile/setting');
129+
});
130+
}
131+
})
132+
.catch((err)=>{
133+
console.log(`${err}`);
134+
});
135+
(data.fname = req.body.fname),
136+
(data.lname = req.body.lname),
137+
(data.bio = req.body.bio),
138+
(data.college = req.body.college),
139+
(data.email = req.body.email),
140+
(data.github = req.body.githubUrl),
141+
(data.linkedin = req.body.linkedinUrl),
142+
(data.city = req.body.city),
143+
(data.country = req.body.country),
144+
(data.lang = req.body.languages),
145+
(data.facebook = req.body.facebookUrl);
146+
data.save()
147+
.then(()=>{
148+
console.log('profile updated !');
149+
// res.send('success');
150+
})
151+
.catch((err)=>{
152+
console.log(`${err}`);
153+
});
124154
});
125155
},
126156
getDetails: function(req, res) {

0 commit comments

Comments
 (0)