Built motion from commit 57474b6.|0.0.99
[motion.git] / server / models / mail_room.js
index bdd8399..170ed3b 100644 (file)
@@ -12,6 +12,14 @@ module.exports = function(sequelize, DataTypes) {
                        type: DataTypes.BOOLEAN,
                        defaultValue: false
                },
+               mailIn: {
+                       type: DataTypes.INTEGER,
+                       defaultValue: 0
+               },
+               mailOut: {
+                       type: DataTypes.INTEGER,
+                       defaultValue: 0
+               },
                status: {
                        type: DataTypes.ENUM('NEW', 'OPEN', 'CLOSED', 'UNMANAGED'),
                        defaultValue: 'NEW'
@@ -19,15 +27,24 @@ module.exports = function(sequelize, DataTypes) {
                lastEvent: {
                        type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE')
                },
+               lastEventAt: {
+                       type: DataTypes.DATE
+               },
                tags: {
                        type: DataTypes.TEXT,
                        get: function() {
-                               return this.getDataValue('tags') ? this.getDataValue('tags').split(';') : [];
+                               return this.getDataValue('tags') ? this.getDataValue('tags').split(';').pop() : [];
                        },
                        set: function(val) {
-                               this.setDataValue('tags', val.join(';'));
+                               this.setDataValue('tags', val && val.length ? val.join(';') + ';' : null);
                        }
-               }
+               },
+               disposition: {
+                       type: DataTypes.STRING
+               },
+               deletedAt: {
+                       type: DataTypes.DATE
+               },
        }, {
                tableName: 'mail_rooms',
                paranoid: true,