<commit_before>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;


/**
 * Article Schema
 */
var CharacterSchema = new Schema({
  created: {
    type: Date,
    default: Date.now
  },
  name: {
    type: String,
    required: true,
    trim: true
  },
  characterClass: {
    type: Number,
    ref: 'Class'
  },
  gender: {
    type: String,
    required: true
  },
  user: {
    type: Schema.ObjectId,
    ref: 'User',
    required: true,
    unique: true
  }
});

/**
 * Validations
 */
CharacterSchema.path('name').validate(function(name) {
  return !!name;
}, 'Name cannot be blank');

CharacterSchema.path('characterClass').validate(function(characterClass) {
  return !!characterClass;
}, 'Class cannot be blank');

/**
 * Statics
 */<commit_msg>Updated character model to include reference to the characterClass object.<commit_after>'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
  Schema = mongoose.Schema;


/**
 * Article Schema
 */
var CharacterSchema = new Schema({
  created: {
    type: Date,
    default: Date.now
  },
  name: {
    type: String,
    required: true,
    trim: true
  },
  characterClass: {
    type: Schema.ObjectId,
    ref: 'CharacterClass',
    required: true
  },
  gender: {
    type: String,
    required: true
  },
  user: {
    type: Schema.ObjectId,
    ref: 'User',
    required: true,
    unique: true
  }
});

/**
 * Validations
 */
CharacterSchema.path('name').validate(function(name) {
  return !!name;
}, 'Name cannot be blank');

CharacterSchema.path('characterClass').validate(function(characterClass) {
  return !!characterClass;
}, 'Class cannot be blank');

/**
 * Statics
 */
{'fraction_non_alphanumeric': 0.15304347826086956, 'fraction_numerical': 0.0, 'mean_word_length': 3.1490384615384617, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '925949', 'n_tokens_mistral': 544, 'n_tokens_neox': 547, 'n_words': 139}