Built motion from commit 65070aa.|0.0.108
[motion.git] / server / models / analytics_extracted_report.js
index 8ee64a0..9f40792 100644 (file)
@@ -13,14 +13,14 @@ module.exports = function(sequelize, DataTypes) {
       type: DataTypes.DATE,
       get: function() {
         // 'this' allows you to access attributes of the instance
-        return moment(this.getDataValue('startDate')).format("DD-MM-YYYY").toString();
+        return moment(this.getDataValue('startDate')).format("DD-MM-YYYY");
       }
     },
     endDate: {
       type: DataTypes.DATE,
       get: function() {
         // 'this' allows you to access attributes of the instance
-        return moment(this.getDataValue('endDate')).format("DD-MM-YYYY").toString();
+        return moment(this.getDataValue('endDate')).format("DD-MM-YYYY");
       }
     },
     status: {
@@ -31,16 +31,19 @@ module.exports = function(sequelize, DataTypes) {
       type: DataTypes.DATE,
       get: function() {
         // 'this' allows you to access attributes of the instance
-        return moment(this.getDataValue('createdAt')).format("DD-MM-YYYY").toString();
+        return moment(this.getDataValue('createdAt')).format("DD-MM-YYYY");
       }
     },
+    type: {
+      type: DataTypes.STRING,
+      defaultValue: 'manual'
+    },
+    UserId: DataTypes.INTEGER
   }, {
     tableName: 'analytics_extracted_reports',
-    // associate: function(models) {
-    //   Tag.belongsToMany(models.Contact, {
-    //     through: 'contact_tags'
-    //   });
-    // }
+    associate: function(models) {
+      ExtractedReport.belongsTo(models.MailMessage);
+    }
   });
 
   return ExtractedReport;