const mongoose = require('mongoose');
const Schema =  mongoose.Schema;

const urlPattern = new RegExp("(http|ftp|https)://(\.[\w-]*)+([\w.,@?^=%&amp;:/~+#-]*[\w@?^=%&amp;/~+#-])?");

const userNameSchema = {
  title: String,
  first: String,
  last: String
};

const userLocationSchema = {
  street: String,
  city: String,
  state: String,
  zip: Number
};

const userPictureSchema = {
  large: { type:String, validate: validateURL },
  medium: { type:String, validate: validateURL },
  thumbnail: { type:String, validate: validateURL }
};

function validateURL(url){
	console.log(urlPattern.test(url));
	return urlPattern.test(url);
}

module.exports = mongoose.model('User', new Schema({
  gender: String,
  name: userNameSchema,
  location: userLocationSchema,
  email: String,
  username: String,
  password: String,
  salt: String,
  md5: String,
  sha1: String,
  sha256: String,
  registered: Date,
  dob: Date,
  phone: String,
  cell: String,
  PPS: String,
  picture: userPictureSchema
}));
@@ -214,145 +214,313 @@
 le: 
-String,%0A  first: String,%0A  last: String%0A%7D;%0A%0Aconst userLocationSchema = %7B%0A  street: String,%0A  city: String,%0A  state: String,%0A  zip: Number
+%7B type:String, required: true%7D,%0A  first: %7B type:String, required: true%7D,%0A  last: %7B type:String, required: true%7D%0A%7D;%0A%0Aconst userLocationSchema = %7B%0A  street: %7B type:String, required: true%7D,%0A  city: %7B type:String, required: true%7D,%0A  state: %7B type:String, required: true%7D,%0A  zip: %7B type:Number, required: true%7D
 %0A%7D;%0A
@@ -563,32 +563,48 @@
 : %7B type:String,
+ required: true,
  validate: valid
@@ -629,32 +629,48 @@
 : %7B type:String,
+ required: true,
  validate: valid
@@ -706,16 +706,31 @@
 :String,
+required: true,
  validat
@@ -909,22 +909,46 @@
 gender: 
-String
+%7B type:String, required: true%7D
 ,%0A  name
@@ -1010,200 +1010,488 @@
 il: 
-String,%0A  username: String,%0A  password: String,%0A  salt: String,%0A  md5: String,%0A  sha1: String,%0A  sha256: String,%0A  registered: Date,%0A  dob: Date,%0A  phone: String,%0A  cell: String,%0A  PPS: String
+%7B type:String, required: true%7D,%0A  username: %7B type:String, required: true%7D,%0A  password: %7B type:String, required: true%7D,%0A  salt: %7B type:String, required: true%7D,%0A  md5: %7B type:String, required: true%7D,%0A  sha1: %7B type:String, required: true%7D,%0A  sha256: %7B type:String, required: true%7D,%0A  registered: %7B type:Date, required: true%7D,%0A  dob: %7B type:Date, required: true%7D,%0A  phone: %7B type:String, required: true%7D,%0A  cell: %7B type:String, required: true%7D,%0A  PPS: %7B type:String, required: true%7D
 ,%0A  
@@ -1521,8 +1521,9 @@
 ema%0A%7D));
+%0A

Set all fields to be required