Built motion from commit 1038d87.|0.0.141
[motion.git] / server / models / fax_message.js
index 7c0657d..1b43851 100644 (file)
@@ -1 +1,65 @@
-var _0xbfc5=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x52\x45\x43\x45\x49\x56\x45\x44","\x4E\x4F\x54\x20\x53\x45\x4E\x54","\x53\x45\x4E\x44\x49\x4E\x47","\x53\x45\x4E\x54","\x46\x41\x49\x4C\x45\x44","\x42\x4F\x4F\x4C\x45\x41\x4E","\x54\x45\x58\x54","\x66\x61\x78\x5F\x6D\x65\x73\x73\x61\x67\x65\x73","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x46\x72\x6F\x6D","\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0xbfc5[0]);module[_0xbfc5[1]]=function(_0xab4dx2,_0xab4dx3){var _0xab4dx4=_0xab4dx2[_0xbfc5[16]](_0xbfc5[2],{actionid:_0xab4dx3[_0xbfc5[3]],channel:_0xab4dx3[_0xbfc5[3]],channelstate:_0xab4dx3[_0xbfc5[4]],channelstatedesc:_0xab4dx3[_0xbfc5[3]],calleridnum:_0xab4dx3[_0xbfc5[3]],calleridname:_0xab4dx3[_0xbfc5[3]],connectedlinenum:_0xab4dx3[_0xbfc5[3]],connectedlinename:_0xab4dx3[_0xbfc5[3]],status:{type:_0xab4dx3.ENUM(_0xbfc5[5],_0xbfc5[6],_0xbfc5[7],_0xbfc5[8],_0xbfc5[9]),allowNull:true},read:{type:_0xab4dx3[_0xbfc5[10]],defaultValue:false},favorite:{type:_0xab4dx3[_0xbfc5[10]],defaultValue:false},language:_0xab4dx3[_0xbfc5[3]],accountcode:_0xab4dx3[_0xbfc5[3]],context:_0xab4dx3[_0xbfc5[3]],exten:_0xab4dx3[_0xbfc5[3]],priority:_0xab4dx3[_0xbfc5[4]],uniqueid:_0xab4dx3[_0xbfc5[3]],localstationid:_0xab4dx3[_0xbfc5[3]],remotestationid:_0xab4dx3[_0xbfc5[3]],pagestransferred:_0xab4dx3[_0xbfc5[4]],resolution:_0xab4dx3[_0xbfc5[3]],transferrate:_0xab4dx3[_0xbfc5[3]],filename:_0xab4dx3[_0xbfc5[3]],filenamePDF:_0xab4dx3[_0xbfc5[3]],operation:_0xab4dx3[_0xbfc5[3]],uuid:_0xab4dx3[_0xbfc5[3]],laststatus:_0xab4dx3[_0xbfc5[3]],error:_0xab4dx3[_0xbfc5[3]],body:_0xab4dx3[_0xbfc5[11]]},{tableName:_0xbfc5[12],associate:function(_0xab4dx5){_0xab4dx4[_0xbfc5[13]](_0xab4dx5.FaxRoom);_0xab4dx4[_0xbfc5[13]](_0xab4dx5.Contact,{as:_0xbfc5[14]});_0xab4dx4[_0xbfc5[13]](_0xab4dx5.Contact,{as:_0xbfc5[15]})}});return _0xab4dx4}
\ No newline at end of file
+'use strict';
+
+const _ = require('lodash');
+
+module.exports = function(sequelize, DataTypes) {
+
+       var FaxMessage = sequelize.define('FaxMessage', {
+               from: DataTypes.STRING,
+               to: DataTypes.STRING,
+               status: {
+                       type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE'),
+                       defaultValue: 'SENDING'
+               },
+               // actionid: DataTypes.STRING,
+               channel: DataTypes.STRING,
+               channelstate: DataTypes.INTEGER,
+               channelstatedesc: DataTypes.STRING,
+               calleridnum: DataTypes.STRING,
+               calleridname: DataTypes.STRING,
+               connectedlinenum: DataTypes.STRING,
+               connectedlinename: DataTypes.STRING,
+               accountcode: DataTypes.STRING,
+               context: DataTypes.STRING,
+               exten: DataTypes.STRING,
+               priority: DataTypes.INTEGER,
+               uniqueid: DataTypes.STRING,
+               linkedid: DataTypes.STRING,
+               localstationid: DataTypes.STRING,
+               remotestationid: DataTypes.STRING,
+               pagestransferred: {
+                       type: DataTypes.INTEGER,
+                       defaultValue: 0
+               },
+               resolution: DataTypes.STRING,
+               transferrate: DataTypes.STRING,
+               filename: DataTypes.STRING,
+               lastStatus: DataTypes.STRING,
+               error: DataTypes.STRING,
+               // body: DataTypes.TEXT,
+               text: {
+                       type: DataTypes.BLOB,
+                       get: function() {
+                               if (this.getDataValue('text')) {
+                                       return _.toString(this.getDataValue('text'));
+                               }
+                       }
+               },
+               retry: {
+                       type: DataTypes.INTEGER,
+                       defaultValue: 0
+               }
+       }, {
+               tableName: 'fax_messages',
+               paranoid: true,
+               associate: function(models) {
+                       FaxMessage.belongsTo(models.FaxRoom, {
+                               onDelete: 'cascade'
+                       });
+                       FaxMessage.belongsTo(models.User);
+                       FaxMessage.hasMany(models.FaxAttachment);
+               }
+       });
+
+       return FaxMessage;
+};