<commit_before>var _ = require('lodash');
var mongoose = require('mongoose');
var utils = require('./utils.js');

var codeSchema = mongoose.Schema({
  type: {type: String, default: 'pizza'},
  number: {type: Number, default: 1},
  verified: {type: Boolean, default: false},
  hash: {type: String, default: utils.generateCode, unique: true}
}, {autoIndex: false});

codeSchema.path('hash').index({unique: true});

var Code = mongoose.model('Code', codeSchema);

function createCode (params) {
  params = _.pick(params, 'limit', 'type', 'number');
  var code = new Code(params);
  code.save();
  return code;
}

function verifyCode (params, callback) {
  params = _.pick(params, 'hash', 'type');<commit_msg>default type promo for code verification<commit_after>var _ = require('lodash');
var mongoose = require('mongoose');
var utils = require('./utils.js');

var codeSchema = mongoose.Schema({
  type: {type: String, default: 'pizza'},
  number: {type: Number, default: 1},
  verified: {type: Boolean, default: false},
  hash: {type: String, default: utils.generateCode, unique: true}
}, {autoIndex: false});

codeSchema.path('hash').index({unique: true});

var Code = mongoose.model('Code', codeSchema);

function createCode (params) {
  params = _.pick(params, 'limit', 'type', 'number');
  var code = new Code(params);
  code.save();
  return code;
}

function verifyCode (params, callback) {
  params = _.pick(params, 'hash', 'type');
  params.type = params.type || 'promo';
{'fraction_non_alphanumeric': 0.18009478672985782, 'fraction_numerical': 0.0013540961408259986, 'mean_word_length': 5.2893617021276595, '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': '291239', 'n_tokens_mistral': 469, 'n_tokens_neox': 478, 'n_words': 135}