Built motion from commit 2239aeb.|0.0.113
[motion.git] / server / models / history / report_call_history.js
index 0e0b0f1..d1411b2 100644 (file)
@@ -5,6 +5,15 @@
 module.exports = function(sequelize, DataTypes) {
 
   var ReportCallHistory = sequelize.define('ReportCallHistory', {
+    uniqueid: {
+      type: DataTypes.STRING,
+      unique: true
+    },
+    type: {
+      type: DataTypes.ENUM,
+      values: ['inbound', 'internal', 'outbound', 'inbound-fax', 'outbound-fax', 'tigerdial']
+    },
+    tag: DataTypes.STRING,
     accountcode: DataTypes.STRING,
     source: DataTypes.STRING,
     destination: DataTypes.STRING,
@@ -30,12 +39,22 @@ module.exports = function(sequelize, DataTypes) {
     billableseconds: DataTypes.INTEGER,
     disposition: DataTypes.STRING,
     amaflags: DataTypes.STRING,
-    uniqueid: DataTypes.STRING,
-    userfield: DataTypes.STRING,
+    userfield: DataTypes.STRING
   }, {
-    tableName: 'report_call_history'
+    tableName: 'report_call_history',
+    associate: function(models) {
+      // ReportCallHistory.hasMany(models.ReportQueueHistory, {
+      //   as: 'HistoryQueueCalls',
+      //   foreignKey: 'uniqueid',
+      //   constraints: false
+      // });
+      // ReportCallHistory.hasMany(models.ReportAgentHistory, {
+      //   as: 'HistoryReportAgents',
+      //   foreignKey: 'uniqueid',
+      //   constraints: false
+      // });
+    }
   });
-
   ReportCallHistory.removeAttribute('id');
   return ReportCallHistory;
 };