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) {