Built motion from commit 945d615.|1.0.13
[motion.git] / server / models / int_sugarcrm_configuration.js
index 3f7b360..4d3bd00 100644 (file)
@@ -3,7 +3,28 @@
 module.exports = function(sequelize, DataTypes) {
   return sequelize.define('SugarcrmConfiguration', {
     name: DataTypes.STRING,
-    description: DataTypes.STRING
+    description: DataTypes.STRING,
+    defaultMapping: {
+      type: DataTypes.BOOLEAN,
+      defaultValue: true
+    },
+    mappingModule: DataTypes.STRING,
+    mappingFields: {
+      type: DataTypes.TEXT,
+      get: function() {
+        var mappingFields;
+        if (this.getDataValue('mappingFields')) {
+          mappingFields = this.getDataValue('mappingFields').split(';');
+          mappingFields.pop();
+        } else {
+          mappingFields = [];
+        }
+        return mappingFields;
+      },
+      set: function(val) {
+        this.setDataValue('mappingFields', val && val.length ? val.join(';') + ';' : null);
+      }
+    }
   }, {
     tableName: 'int_sugarcrm_configurations',
     associate: function(models) {