<commit_before>// get an instance of mongoose and mongoose.Schema
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var chalk = require('chalk');

var Entry = require('./entry');
var FacebookRatedByMe = require('./facebookRatedByMe');
var Facebook = require('./facebook');
var Facebook = require('./linkedin');

var userSchema = mongoose.Schema({
    userDetails: {
        local: {
            firstname: String,
            lastname: String,
            email: String,
            password: String,
            verified: Boolean
        },
        facebook: {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Facebook'
        },
        linkedin: {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'LinkedIn'
        },
        created: {
            type: Date,
            default: Date.now
        }
    },
    facebook: {
        ratedByMe: [{
            type: mongoose.Schema.Types.ObjectId,
            ref: 'FacebookRatedByMe'
        }],
        ratedByOthers: [{
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Facebook'
        }]
    },
    linkedin: {}
});

// // set up a mongoose model and pass it using module.exports
// module.exports = mongoose.model('User', new Schema());

// generating a hash
userSchema.methods.generateHash = function (password) {
    return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};

// checking if password is valid
userSchema.methods.validPassword = function (password) {
    console.log(chalk.yellow('Checking passwords . . .: ' + password));
    return bcrypt.compareSync(password, this.userDetails.local.password);
};

// create the model for users and expose it to our app
module.exports = mongoose.model('User', userSchema);
<commit_msg>User schema change to support rate count<commit_after>// get an instance of mongoose and mongoose.Schema
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var chalk = require('chalk');

var Entry = require('./entry');
var FacebookRatedByMe = require('./facebookRatedByMe');
var Facebook = require('./facebook');
var Facebook = require('./linkedin');

var userSchema = mongoose.Schema({
    userDetails: {
        local: {
            firstname: String,
            lastname: String,
            email: String,
            password: String,
            verified: Boolean
        },
        facebook: {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Facebook'
        },
        linkedin: {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'LinkedIn'
        },
        created: {
            type: Date,
            default: Date.now
        }
    },
    facebook: {
        ratedByMe: [{
            type: mongoose.Schema.Types.ObjectId,
            ref: 'FacebookRatedByMe'
        }],
        ratedByOthers: [{
            type: mongoose.Schema.Types.ObjectId,
            ref: 'Entry'
        }]
    },
    linkedin: {}
});

// // set up a mongoose model and pass it using module.exports
// module.exports = mongoose.model('User', new Schema());

// generating a hash
userSchema.methods.generateHash = function (password) {
    return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};

// checking if password is valid
userSchema.methods.validPassword = function (password) {
    console.log(chalk.yellow('Checking passwords . . .: ' + password));
    return bcrypt.compareSync(password, this.userDetails.local.password);
};

// create the model for users and expose it to our app
module.exports = mongoose.model('User', userSchema);

{'fraction_non_alphanumeric': 0.12569521690767518, 'fraction_numerical': 0.0005561735261401557, 'mean_word_length': 2.309107635694572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6769633', 'n_tokens_mistral': 1008, 'n_tokens_neox': 1012, 'n_words': 252}