/**
 * 	record.js
 */

var mongoose = require('mongoose'),
	validator = require('validator'); 

var nameLength = function (val) {
		return validator.isLength(val, 3, 100);
	},
	descriptionLength = function (val) {
		return validator.isLength(val, 3, 1000);
	};

module.exports = mongoose.model('Record', {
	'name': {
		'required': true,
		'type': 'String',
		'validate': [{
			'validator': nameLength,
			'msg': 'Invalid format'
		}]
	},
	'description': {
		'required': true,
		'type': 'String',
		'validate': [{
			'validator': descriptionLength,
			'msg': 'Invalid format'
		}]
	},
	'userId': {
		'required': true,
		'type': 'String'
	}
});