Built motion from commit 2239aeb.|0.0.113
[motion.git] / server / models / report_chat.js
index 8f1febf..4574bde 100644 (file)
@@ -7,15 +7,14 @@ var moment = require('moment');
 module.exports = function(sequelize, DataTypes) {
 
   var ReportChat = sequelize.define('ReportChat', {
-
     uniqueid: DataTypes.STRING,
     timeslot: DataTypes.INTEGER,
     websitename: DataTypes.STRING,
     websiteaddress: DataTypes.STRING,
     websiteid: DataTypes.INTEGER,
     application: DataTypes.STRING,
-    agentid: DataTypes.INTEGER,
-    agentname: DataTypes.STRING,
+    memberid: DataTypes.INTEGER,
+    membername: DataTypes.STRING,
     visitorid: DataTypes.STRING,
     visitorname: DataTypes.STRING,
     visitoremail: DataTypes.STRING,
@@ -29,13 +28,20 @@ module.exports = function(sequelize, DataTypes) {
     connectid: {
       type: DataTypes.STRING,
       unique: true,
-      set: function(agentconnectedAt) {
-        this.setDataValue('connectid', this.uniqueid);
+      set: function(connectid) {
+        this.setDataValue('connectid', connectid);
         this.setDataValue('reason', 'connect');
         this.setDataValue('connectedAt', moment().format("YYYY-MM-DD HH:mm:ss"));
       }
     },
     calledAt: DataTypes.DATE,
+    rejectedAt: {
+      type: DataTypes.DATE,
+      set: function(rejectedAt) {
+        this.setDataValue('rejectedAt', rejectedAt);
+        this.setDataValue('reason', 'rejected');
+      }
+    },
     connectedAt: DataTypes.DATE
   }, {
     tableName: 'report_chat'