3 module.exports = function(sequelize, DataTypes) {
4 var VoiceQueue = sequelize.define('VoiceQueue', {
6 type: DataTypes.STRING,
12 args: /^[A-Za-z0-9._\+*!\-\[\]]+$/,
13 msg: 'The name is not valid!'
18 type: DataTypes.STRING,
20 defaultValue: 'default'
23 type: DataTypes.STRING,
28 type: DataTypes.ENUM('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered'),
30 defaultValue: 'ringall'
33 type: DataTypes.INTEGER(11),
38 type: DataTypes.STRING,
42 penaltymemberslimit: {
43 type: DataTypes.INTEGER(11),
47 type: DataTypes.INTEGER(11),
52 type: DataTypes.INTEGER(11),
57 type: DataTypes.STRING,
61 type: DataTypes.INTEGER(11),
66 type: DataTypes.INTEGER(11),
71 type: DataTypes.ENUM('yes', 'no'),
76 type: DataTypes.ENUM('yes', 'no', 'all'),
81 type: DataTypes.INTEGER(11),
85 type: DataTypes.ENUM('yes', 'no'),
90 type: DataTypes.ENUM('yes', 'no'),
95 type: DataTypes.INTEGER(11),
100 type: DataTypes.ENUM('yes', 'no'),
105 type: DataTypes.ENUM('yes', 'no'),
110 type: DataTypes.ENUM('yes', 'no'),
115 type: DataTypes.STRING,
119 type: DataTypes.STRING,
122 announce_frequency: {
123 type: DataTypes.INTEGER(11),
127 min_announce_frequency: {
128 type: DataTypes.INTEGER(11),
132 periodic_announce_frequency: {
133 type: DataTypes.INTEGER(11),
137 random_periodic_announce: {
138 type: DataTypes.ENUM('yes', 'no'),
142 relative_periodic_announce: {
143 type: DataTypes.ENUM('yes', 'no'),
148 type: DataTypes.ENUM('yes', 'no', 'once'),
153 type: DataTypes.STRING,
157 announce_to_first_user: {
158 type: DataTypes.ENUM('yes', 'no'),
161 announce_position_limit: {
162 type: DataTypes.INTEGER(11),
165 announce_round_seconds: {
166 type: DataTypes.ENUM('0', '5', '10', '15', '20', '30'),
171 type: DataTypes.STRING,
176 type: DataTypes.STRING,
180 type: DataTypes.STRING,
185 type: DataTypes.STRING,
189 queue_callswaiting: {
190 type: DataTypes.STRING,
195 type: DataTypes.STRING,
200 type: DataTypes.STRING,
205 type: DataTypes.STRING,
210 type: DataTypes.STRING,
215 type: DataTypes.STRING,
220 type: DataTypes.STRING,
224 type: DataTypes.STRING,
228 type: DataTypes.STRING,
231 queue_periodic_announce: {
232 type: DataTypes.STRING,
236 type: DataTypes.STRING,
240 type: DataTypes.STRING,
245 type: DataTypes.STRING,
250 type: DataTypes.STRING,
255 type: DataTypes.ENUM('yes', 'no'),
260 type: DataTypes.ENUM('yes', 'no'),
265 type: DataTypes.INTEGER(11),
270 type: DataTypes.ENUM('yes', 'no'),
275 type: DataTypes.STRING,
279 type: DataTypes.STRING,
283 type: DataTypes.BOOLEAN,
287 type: DataTypes.INTEGER(11),
291 tableName: 'voice_queues',
292 associate: function(models) {
293 VoiceQueue.belongsToMany(models.User, {
294 through: models.UserHasVoiceQueue,
298 VoiceQueue.belongsToMany(models.User, {
299 through: models.UserHasVoiceQueuePermit,
305 VoiceQueue.beforeUpdate(function(updatedQueue) {
306 if (updatedQueue.changed('name')) {
307 throw new Error("You can't modify a queue name");