7d81cf5bb334815a0cc11e683e9e772a8cfe7848
[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     record: {
23       type: DataTypes.BOOLEAN,
24       defaultValue: false
25     },
26     recordingFormat: {
27       type: DataTypes.STRING,
28       defaultValue: 'wav'
29     }
30   }, {
31     tableName: 'voice_chanspy',
32     associate: function(models) {
33       ChanSpy.hasMany(models.VoiceExtension, {
34         as: 'SpiedAgents',
35         onDelete: 'cascade',
36         hooks: true
37       });
38     }
39   });
40
41   return ChanSpy;
42 };