Skip to content

Commit

Permalink
Extend sign up functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
CamileDahdah committed Apr 18, 2018
1 parent fb338ce commit 5896eff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const config = {
jwtKey: 'MRePUBWaNW7wvNKMcOCkGlo6ZipKs4HKiRq2yAYV33FroszPKV0kOsnbtaIM',
databaseUrl: 'mongodb://localhost:27017/myproject'
databaseUrl: 'mongodb://localhost:27017/local'
};

module.exports = config;
19 changes: 16 additions & 3 deletions models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ const path = require('path');
const UserEventSchema = require(path.resolve('models/user_event_schema'))

const UserSchema = new mongoose.Schema({
name: {

firstName: {
type: String
},
lastName: {
type: String
},
email: {
Expand All @@ -15,10 +19,19 @@ const UserSchema = new mongoose.Schema({
password: {
type: String
},
phoneNumber: {
type: String,
},
city: {
type: String,
},
country: {
type: String,
},
salt: {
type: String
},
events: [UserEventSchema]
}

});

UserSchema.pre('save', function (next) {
Expand Down
8 changes: 6 additions & 2 deletions routes/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ const endpoints = [
auth: false,
validate: {
payload: {
name: joi.string().min(5).required(),
firstName: joi.string().min(5).required(),
lastName: joi.string().min(5).required(),
email: joi.string().email().required(),
password: joi.string().required()
password: joi.string().required(),
phoneNumber: joi.string().required(),
city: joi.string().required(),
country: joi.string().required()
}
}
},
Expand Down

0 comments on commit 5896eff

Please sign in to comment.