3599ea7053c0f13b0d70330c1e5b160818ebd938
[motion.git] / server / models / settings.js
1 'use strict';
2
3 module.exports = function(sequelize, DataTypes) {
4
5   var Settings = sequelize.define('Settings', {
6     license: DataTypes.TEXT,
7     mac: {
8       type: DataTypes.STRING(17),
9       allowNull: false,
10       validate: {
11         notEmpty: true,
12         // isMac: function(value) {
13         //   if (!getmac.isMac(value)) {
14         //     throw new Error('Invalid Mac!');
15         //   }
16         // }
17       }
18     },
19     netmask: {
20       type: DataTypes.STRING(15),
21       allowNull: false,
22       validate: {
23         notEmpty: true,
24         isIP: true
25       }
26     },
27     address: {
28       type: DataTypes.STRING(15),
29       allowNull: false,
30       validate: {
31         notEmpty: true,
32         isIP: true
33       }
34     },
35     min_internal: {
36       type: DataTypes.INTEGER(11),
37       unique: true
38     },
39     agi_port: {
40       type: DataTypes.INTEGER(11)
41     },
42     automation_timeout: {
43       type: DataTypes.INTEGER(11),
44       defaultValue: 3600
45     }
46   }, {
47     tableName: 'settings'
48   });
49
50   return Settings;
51
52 };