{"size": 875, "ext": "js", "max_stars_repo_path": "app/types/link.js", "max_stars_repo_name": "thepropterhoc/Cha_The_Pivot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/types/link.js", "max_issues_repo_name": "thepropterhoc/Cha_The_Pivot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/types/link.js", "max_forks_repo_name": "thepropterhoc/Cha_The_Pivot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.2258064516, "max_line_length": 76, "alphanum_fraction": 0.736}
// grab the things we need
var mongoose = require('mongoose');
var bcrypt = require('bcrypt');
var Schema = mongoose.Schema;

// create a schema
var userSchema = new Schema({
	externalEmail : String,
	internalEmail : String,
	accountType : Number,
	passwordHash : String,
	firstName : String,
	lastName : String
});

// custom method to add string to end of name
// you can create more important methods like name validations or formatting
// you can also do queries and find similar users 
userSchema.methods.authenticate = function(checkPass) {
  // add some stuff to the users name
 bcrypt.compare(checkPass, this.passwordHash, function(err, res){
 	return res;
 });
};

// the schema is useless so far
// we need to create a model using it
var User = mongoose.model('User', userSchema);

// make this available to our users in our Node applications
module.exports = User;