Built motion from commit b33b832.|1.0.17
[motion.git] / server / models / history / report_mail_history.js
index 0af6acd..ce5f025 100644 (file)
@@ -7,6 +7,7 @@ var moment = require('moment');
 module.exports = function(sequelize, DataTypes) {
 
   var ReportMailHistory = sequelize.define('ReportMailHistory', {
+    sourceid: DataTypes.INTEGER,
     uniqueid: DataTypes.STRING,
     timeslot: DataTypes.INTEGER,
     subject: DataTypes.STRING,
@@ -26,18 +27,19 @@ module.exports = function(sequelize, DataTypes) {
     },
     connectid: {
       type: DataTypes.STRING,
-      unique: true,
-      set: function(agentconnectedAt) {
-        this.setDataValue('connectid', this.uniqueid);
-        this.setDataValue('reason', 'connect');
-        this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss"));
-      }
+      unique: 'connectid'
     },
     calledAt: DataTypes.DATE,
-    connectedAt: DataTypes.DATE
+    connectedAt: DataTypes.DATE,
+    rejectedAt: DataTypes.DATE,
+    from: DataTypes.STRING
   }, {
-    tableName: 'report_mail_history'
+    tableName: 'report_mail_history',
+    indexes: [{
+      name: 'sourceid',
+      fields: ['sourceid']
+    }]
   });
-
+  ReportMailHistory.removeAttribute('id');
   return ReportMailHistory;
 };