Built motion from commit 1038d87.|0.0.141
[motion.git] / server / models / voice_chanspy.js
1 'use strict';
2
3 module.exports = function(sequelize, DataTypes) {
4
5   var ChanSpy = sequelize.define('ChanSpy', {
6     name: DataTypes.STRING,
7     prefix: {
8       type: DataTypes.STRING,
9       unique: true,
10       allowNull: false,
11       validate: {
12         notEmpty: true,
13       },
14     },
15     options: DataTypes.STRING,
16     auth: {
17       type: DataTypes.BOOLEAN,
18       defaultValue: false
19     },
20     password: DataTypes.STRING,
21     description: DataTypes.STRING
22   }, {
23     tableName: 'voice_chanspy',
24     associate: function(models) {
25       ChanSpy.hasMany(models.VoiceExtension, {
26         as: 'SpiedAgents',
27         onDelete: 'cascade',
28         hooks: true
29       });
30     }
31   });
32
33   return ChanSpy;
34 };