* Chat Website Model
*/
-var crypto = require('crypto');
+var _ = require('lodash');
module.exports = function(sequelize, DataTypes) {
}
},
to: {
- type: DataTypes.STRING,
+ type: DataTypes.TEXT,
get: function() {
return this.getDataValue('to') ? this.getDataValue('to').split(';') : [];
},
}
},
cc: {
- type: DataTypes.STRING,
+ type: DataTypes.TEXT,
get: function() {
return this.getDataValue('cc') ? this.getDataValue('cc').split(';') : [];
},
}
},
bcc: {
- type: DataTypes.STRING,
+ type: DataTypes.TEXT,
get: function() {
return this.getDataValue('bcc') ? this.getDataValue('bcc').split(';') : [];
},
this.setDataValue('bcc', val.join(';'));
}
},
+ fromId: {
+ type: DataTypes.INTEGER
+ },
attachment: DataTypes.TEXT,
text: {
type: DataTypes.BLOB,
get: function() {
if (this.getDataValue('text')) {
- return this.getDataValue('text').toString();
+ return _.toString(this.getDataValue('text'));
}
}
},
type: DataTypes.BLOB,
get: function() {
if (this.getDataValue('html')) {
- return this.getDataValue('html').toString();
+ if (this.getDataValue('html')) {
+ return _.toString(this.getDataValue('html'));
+ }
}
- }
+ },
},
reason: DataTypes.TEXT,
status: {
- type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE'),
+ type: DataTypes.ENUM('SENDING', 'SENT', 'RECEIVED', 'FAILED', 'NOTE'),
defaultValue: 'SENDING'
- }
+ },
+ retry: {
+ type: DataTypes.INTEGER,
+ defaultValue: 0
+ },
+ voiceSource: DataTypes.STRING
}, {
tableName: 'mail_messages',
paranoid: true,