Built motion from commit 2e74e5e.|0.0.138
[motion.git] / server / models / tools_trunk.js
index 5768b2c..ca991ec 100644 (file)
@@ -410,7 +410,7 @@ module.exports = function(sequelize, DataTypes) {
     call_limit: {
       type: DataTypes.INTEGER(11),
       allowNull: true,
-      defaultValue: null
+      defaultValue: 1000
     },
     registertrying: { //Send a 100 Trying when the device registers.
       type: DataTypes.ENUM('yes', 'no'),
@@ -452,10 +452,26 @@ module.exports = function(sequelize, DataTypes) {
     otherFields: {
       type: DataTypes.STRING,
       allowNull: true,
+    },
+    active: {
+      type: DataTypes.BOOLEAN,
+      defaultValue: true
+    },
+    status: {
+      type: DataTypes.STRING
+    },
+    peerstatus: {
+      type: DataTypes.STRING
     }
   }, {
     tableName: 'tools_trunks'
   });
 
+  Trunk.beforeUpdate(function(doc) {
+    if (doc.changed('name')) {
+      throw new Error("You can't modify a trunk name");
+    }
+  });
+
   return Trunk;
 }