Built motion from commit 8dae768.|0.0.121
[motion.git] / server / models / sms_room.js
index 7558bb3..09e3989 100644 (file)
@@ -12,6 +12,16 @@ module.exports = function(sequelize, DataTypes) {
       type: DataTypes.ENUM('NEW', 'OPEN', 'CLOSED', 'UNMANAGED'),
       defaultValue: 'NEW'
     },
+    lastEvent: {
+      type: DataTypes.ENUM('SENDING', 'SENT', 'RECEIVED', 'FAILED', 'NOTE')
+    },
+    lastEventAt: {
+      type: DataTypes.DATE
+    },
+    waiting: {
+      type: DataTypes.BOOLEAN,
+      defaultValue: false
+    },
     tags: {
       type: DataTypes.TEXT,
       get: function() {
@@ -28,13 +38,16 @@ module.exports = function(sequelize, DataTypes) {
         this.setDataValue('tags', val && val.length ? val.join(';') + ';' : null);
       }
     },
-    waiting: {
-      type: DataTypes.BOOLEAN,
-      defaultValue: false
-    },
     disposition: {
       type: DataTypes.STRING
     },
+    openReason: DataTypes.STRING,
+    arrivedAt: {
+      type: DataTypes.DATE
+    },
+    closedAt: {
+      type: DataTypes.DATE
+    },
     ParentId: {
       type: DataTypes.INTEGER
     },
@@ -47,6 +60,9 @@ module.exports = function(sequelize, DataTypes) {
     associate: function(models) {
       // BINDING
       SmsRoom.hasMany(models.SmsMessage);
+      SmsRoom.hasMany(models.SmsRoomStatus, {
+        plural: 'SmsRoomStatuses'
+      });
       SmsRoom.belongsToMany(models.User, {
         through: 'user_has_sms_rooms'
       });