Built motion from commit 1038d87.|0.0.141
[motion.git] / server / models / voice_recording.js
index 09a2d53..54bfb0a 100644 (file)
@@ -1 +1,88 @@
-var _0xc56f=["\x6D\x6F\x6D\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x53\x54\x52\x49\x4E\x47","\x49\x4E\x54\x45\x47\x45\x52","\x44\x41\x54\x45","\x4D\x4D\x2D\x44\x44\x2D\x59\x59\x59\x59\x20\x48\x48\x3A\x6D\x6D","\x66\x6F\x72\x6D\x61\x74","\x61\x67\x65\x6E\x74\x63\x6F\x6E\x6E\x65\x63\x74\x41\x74","\x67\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73","\x75\x6E\x69\x71\x75\x65\x69\x64","\x62\x65\x6C\x6F\x6E\x67\x73\x54\x6F","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0xc56f[0]);module[_0xc56f[1]]=function(_0x93acx2,_0x93acx3){var _0x93acx4=_0x93acx2[_0xc56f[13]](_0xc56f[2],{uniqueid:{type:_0x93acx3[_0xc56f[3]],primaryKey:true},channel:{type:_0x93acx3[_0xc56f[3]]},calleridnum:{type:_0x93acx3[_0xc56f[3]]},calleridname:{type:_0x93acx3[_0xc56f[3]]},connectedlinenum:{type:_0x93acx3[_0xc56f[3]]},connectedlinename:{type:_0x93acx3[_0xc56f[3]]},language:{type:_0x93acx3[_0xc56f[3]]},accountcode:{type:_0x93acx3[_0xc56f[3]]},context:{type:_0x93acx3[_0xc56f[3]]},exten:{type:_0x93acx3[_0xc56f[3]]},value:{type:_0x93acx3[_0xc56f[3]]},type:{type:_0x93acx3[_0xc56f[3]]},rating:{type:_0x93acx3[_0xc56f[4]],defaultValue:0,validate:{max:5,min:0}},createdAt:{type:_0x93acx3[_0xc56f[5]],get:function(){return moment(this[_0xc56f[9]](_0xc56f[8]))[_0xc56f[7]](_0xc56f[6])}},updatedAt:{type:_0x93acx3[_0xc56f[5]],get:function(){return moment(this[_0xc56f[9]](_0xc56f[8]))[_0xc56f[7]](_0xc56f[6])}}},{tableName:_0xc56f[10],associate:function(_0x93acx5){_0x93acx4[_0xc56f[12]](_0x93acx5.ReportCall,{foreignKey:_0xc56f[11]})}});return _0x93acx4;};
\ No newline at end of file
+/* jshint indent: 2 */
+var moment = require('moment');
+
+module.exports = function(sequelize, DataTypes) {
+  var VoiceRecording = sequelize.define('VoiceRecording', {
+    uniqueid: {
+      type: DataTypes.STRING
+    },
+    channel: {
+      type: DataTypes.STRING,
+      set: function(channel) {
+        if (channel) {
+          this.setDataValue('channel', channel);
+          this.setDataValue('membername', channel.split(/\/|-/)[1]);
+        }
+      }
+    },
+    membername: {
+      type: DataTypes.STRING
+    },
+    calleridnum: {
+      type: DataTypes.STRING
+    },
+    calleridname: {
+      type: DataTypes.STRING
+    },
+    connectedlinenum: {
+      type: DataTypes.STRING
+    },
+    connectedlinename: {
+      type: DataTypes.STRING
+    },
+    language: {
+      type: DataTypes.STRING
+    },
+    accountcode: {
+      type: DataTypes.STRING
+    },
+    context: {
+      type: DataTypes.STRING
+    },
+    exten: {
+      type: DataTypes.STRING
+    },
+    value: {
+      type: DataTypes.STRING
+    },
+    type: {
+      type: DataTypes.STRING
+    },
+    rating: {
+      type: DataTypes.INTEGER,
+      validate: {
+        max: 5,
+        min: 0
+      }
+    },
+    queue: {
+      type: DataTypes.STRING
+    },
+    customerPhone: {
+      type: DataTypes.STRING
+    },
+    createdAt: {
+      type: DataTypes.DATE,
+      get: function() {
+        // 'this' allows you to access attributes of the instance
+        return moment(this.getDataValue('createdAt')).format("MM-DD-YYYY HH:mm").toString();
+      }
+    },
+    updatedAt: {
+      type: DataTypes.DATE,
+      get: function() {
+        // 'this' allows you to access attributes of the instance
+        return moment(this.getDataValue('updatedAt')).format("MM-DD-YYYY HH:mm").toString();
+      }
+    }
+  }, {
+    tableName: 'voice_recordings',
+    associate: function(models) {
+      // VoiceRecording.belongsTo(models.ReportCall, {
+      //   foreignKey: 'uniqueid'
+      // });
+    }
+  });
+
+  return VoiceRecording;
+};