Skip to content

Commit 1d6e27c

Browse files
authored
Merge pull request #208 from tyler-furby/patch-1
Add forms for profile social accounts and about section
2 parents 8e9c136 + cf4e493 commit 1d6e27c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

config/param-validation.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ export default {
77
username: Joi.string().required(),
88
name: Joi.string().required(),
99
bio: Joi.string().allow(''),
10+
about: Joi.string().allow(''),
11+
github: Joi.string().allow(''),
12+
linkedin: Joi.string().allow(''),
13+
twitter: Joi.string().allow(''),
1014
website: Joi.string().allow(''),
1115
isAvatarSet: Joi.boolean().required(),
12-
email: Joi.string().email().allow('')
16+
email: Joi.string().email().allow(''),
17+
publicEmail: Joi.string().email().allow('')
1318
},
1419
params: {
1520
userId: Joi.string().hex().required()

server/models/user.model.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,21 @@ const UserSchema = new mongoose.Schema({
3434
bio: {
3535
type: String
3636
},
37+
about: {
38+
type: String
39+
},
3740
website: {
3841
type: String
3942
},
43+
linkedin: {
44+
type: String
45+
},
46+
twitter: {
47+
type: String
48+
},
49+
github: {
50+
type: String
51+
},
4052
verified: {
4153
type: Boolean,
4254
default: false
@@ -48,6 +60,9 @@ const UserSchema = new mongoose.Schema({
4860
email: {
4961
type: String
5062
},
63+
publicEmail: {
64+
type: String
65+
},
5166
facebook: {
5267
id: {
5368
type: String
@@ -151,7 +166,7 @@ UserSchema.statics = {
151166
isValidHash: function validPassword({ original, hash }) {
152167
return bcrypt.compareSync(original, hash);
153168
},
154-
updatableFields: ['username', 'website', 'bio', 'name', 'email']
169+
updatableFields: ['username', 'website', 'bio', 'publicEmail', 'twitter', 'github', 'linkedin', 'about', 'name', 'email']
155170
};
156171

157172
/**

0 commit comments

Comments
 (0)