3 module.exports = function(sequelize, DataTypes) {
4 var VoiceQueue = sequelize.define('VoiceQueue', {
6 type: DataTypes.STRING,
11 is: /^[A-Za-z0-9\.\_]+$/i
15 type: DataTypes.STRING,
17 defaultValue: 'default'
20 type: DataTypes.STRING,
25 type: DataTypes.ENUM('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered'),
27 defaultValue: 'ringall'
30 type: DataTypes.INTEGER(11),
35 type: DataTypes.STRING,
39 penaltymemberslimit: {
40 type: DataTypes.INTEGER(11),
44 type: DataTypes.INTEGER(11),
49 type: DataTypes.INTEGER(11),
54 type: DataTypes.STRING,
58 type: DataTypes.INTEGER(11),
63 type: DataTypes.INTEGER(11),
68 type: DataTypes.ENUM('yes', 'no'),
73 type: DataTypes.ENUM('yes', 'no', 'all'),
78 type: DataTypes.INTEGER(11),
82 type: DataTypes.ENUM('yes', 'no'),
87 type: DataTypes.ENUM('yes', 'no'),
92 type: DataTypes.INTEGER(11),
97 type: DataTypes.ENUM('yes', 'no'),
102 type: DataTypes.ENUM('yes', 'no'),
107 type: DataTypes.ENUM('yes', 'no'),
112 type: DataTypes.STRING,
116 type: DataTypes.STRING,
119 announce_frequency: {
120 type: DataTypes.INTEGER(11),
124 min_announce_frequency: {
125 type: DataTypes.INTEGER(11),
129 periodic_announce_frequency: {
130 type: DataTypes.INTEGER(11),
134 random_periodic_announce: {
135 type: DataTypes.ENUM('yes', 'no'),
139 relative_periodic_announce: {
140 type: DataTypes.ENUM('yes', 'no'),
145 type: DataTypes.ENUM('yes', 'no', 'once'),
150 type: DataTypes.STRING,
154 announce_to_first_user: {
155 type: DataTypes.ENUM('yes', 'no'),
158 announce_position_limit: {
159 type: DataTypes.INTEGER(11),
162 announce_round_seconds: {
163 type: DataTypes.ENUM('0', '5', '10', '15', '20', '30'),
168 type: DataTypes.STRING,
173 type: DataTypes.STRING,
177 type: DataTypes.STRING,
182 type: DataTypes.STRING,
186 queue_callswaiting: {
187 type: DataTypes.STRING,
192 type: DataTypes.STRING,
197 type: DataTypes.STRING,
202 type: DataTypes.STRING,
207 type: DataTypes.STRING,
212 type: DataTypes.STRING,
217 type: DataTypes.STRING,
221 type: DataTypes.STRING,
225 type: DataTypes.STRING,
228 queue_periodic_announce: {
229 type: DataTypes.STRING,
233 type: DataTypes.STRING,
237 type: DataTypes.STRING,
242 type: DataTypes.STRING,
247 type: DataTypes.STRING,
252 type: DataTypes.ENUM('yes', 'no'),
257 type: DataTypes.ENUM('yes', 'no'),
262 type: DataTypes.INTEGER(11),
267 type: DataTypes.ENUM('yes', 'no'),
272 type: DataTypes.STRING,
276 type: DataTypes.STRING,
280 type: DataTypes.BOOLEAN,
284 type: DataTypes.INTEGER(11),
288 tableName: 'voice_queues',
289 associate: function(models) {
290 VoiceQueue.belongsToMany(models.User, {
291 through: models.UserHasVoiceQueue,
295 VoiceQueue.belongsToMany(models.User, {
296 through: models.UserHasVoiceQueuePermit,
302 VoiceQueue.beforeUpdate(function(updatedQueue) {
303 if (updatedQueue.changed('name')) {
304 throw new Error("You can't modify a queue name");