Built motion from commit 5b01f56.|0.0.106
[motion.git] / server / models / fax_room.js
index e6418b0..26618af 100644 (file)
@@ -15,7 +15,23 @@ module.exports = function(sequelize, DataTypes) {
     },
     lastEvent: {
       type: DataTypes.ENUM('SENT', 'SENDING', 'RECEIVED', 'FAILED', 'NOTE')
-    }
+    },
+    tags: {
+      type: DataTypes.TEXT,
+      get: function() {
+        var tags;
+        if (this.getDataValue('tags')) {
+          tags = this.getDataValue('tags').split(';');
+          tags.pop();
+        } else {
+          tags = [];
+        }
+        return tags;
+      },
+      set: function(val) {
+        this.setDataValue('tags', val && val.length ? val.join(';') + ';' : null);
+      }
+    },
   }, {
     tableName: 'fax_rooms',
     paranoid: true,
@@ -36,6 +52,8 @@ module.exports = function(sequelize, DataTypes) {
         }, {
           model: models.FaxMessage,
           include: [{
+            model: models.FaxAttachment
+          }, {
             model: models.User,
             attributes: ['id', 'name', 'fullname', 'email']
           }]