Built motion from commit e2ff5cd.|0.0.92
[motion.git] / server / models / sms_application.js
1 'use strict';
2
3 module.exports = function(sequelize, DataTypes) {
4   return sequelize.define('SmsApplication', {
5     app: {
6       type: DataTypes.ENUM('queue', 'agent')
7     },
8     priority: {
9       type: DataTypes.INTEGER
10     },
11     timeout: {
12       type: DataTypes.INTEGER,
13       validate: {
14         min: 1
15       }
16     },
17     interval: {
18       type: DataTypes.STRING
19     }
20   }, {
21     tableName: 'sms_applications',
22     associate: function(models) {
23       // hasMany relations
24       models.SmsApplication.belongsTo(models.User, {
25         onDelete: 'restrict'
26       });
27       models.SmsApplication.belongsTo(models.Interval);
28       models.SmsApplication.belongsTo(models.SmsQueue, {
29         onDelete: 'restrict'
30       });
31       models.SmsApplication.belongsTo(models.SmsAccount);
32     }
33   });
34 };