5 var crypto = require('crypto');
7 module.exports = function(sequelize, DataTypes) {
9 var FaxRoom = sequelize.define('FaxRoom', {
10 from: DataTypes.STRING,
11 account: DataTypes.STRING,
13 type: DataTypes.ENUM('NEW', 'OPEN', 'CLOSED', 'UNMANAGED'),
17 type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE')
22 return this.getDataValue('tags') ? this.getDataValue('tags').split(';') : [];
25 this.setDataValue('tags', val.join(';'));
29 tableName: 'fax_rooms',
31 associate: function(models) {
33 FaxRoom.hasMany(models.FaxMessage);
34 FaxRoom.belongsTo(models.FaxAccount);
35 FaxRoom.belongsToMany(models.User, {
36 through: 'user_has_fax_rooms'
39 FaxRoom.addScope('default', {
44 model: models.FaxAccount
46 model: models.FaxMessage,
48 model: models.FaxAttachment
51 attributes: ['id', 'name', 'fullname', 'email']
55 attributes: ['id', 'name', 'fullname', 'email']