Built motion from commit 82438f7.|0.0.115
[motion.git] / server / models / voice_recording.js
index 4cde776..22c22db 100644 (file)
@@ -1 +1,86 @@
-var _0x2552=["\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","\x64\x65\x66\x69\x6E\x65"];var moment=require(_0x2552[0]);module[_0x2552[1]]=function(_0x222dx2,_0x222dx3){var _0x222dx4=_0x222dx2[_0x2552[11]](_0x2552[2],{uniqueid:{type:_0x222dx3[_0x2552[3]],primaryKey:true},channel:{type:_0x222dx3[_0x2552[3]]},calleridnum:{type:_0x222dx3[_0x2552[3]]},calleridname:{type:_0x222dx3[_0x2552[3]]},connectedlinenum:{type:_0x222dx3[_0x2552[3]]},connectedlinename:{type:_0x222dx3[_0x2552[3]]},language:{type:_0x222dx3[_0x2552[3]]},accountcode:{type:_0x222dx3[_0x2552[3]]},context:{type:_0x222dx3[_0x2552[3]]},exten:{type:_0x222dx3[_0x2552[3]]},value:{type:_0x222dx3[_0x2552[3]]},type:{type:_0x222dx3[_0x2552[3]]},rating:{type:_0x222dx3[_0x2552[4]],defaultValue:0,validate:{max:5,min:0}},createdAt:{type:_0x222dx3[_0x2552[5]],get:function(){return moment(this[_0x2552[9]](_0x2552[8]))[_0x2552[7]](_0x2552[6])}},updatedAt:{type:_0x222dx3[_0x2552[5]],get:function(){return moment(this[_0x2552[9]](_0x2552[8]))[_0x2552[7]](_0x2552[6])}}},{tableName:_0x2552[10],associate:function(_0x222dx5){}});return _0x222dx4}
\ 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,
+      defaultValue: 0,
+      validate: {
+        max: 5,
+        min: 0
+      }
+    },
+    queue: {
+      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;
+};