4 var moment = require('moment');
6 module.exports = function(sequelize, DataTypes) {
8 var ExtractedReport = sequelize.define('ExtractedReport', {
9 name: DataTypes.STRING,
10 output: DataTypes.STRING, //csv,pdf,..
11 savename: DataTypes.STRING,
15 // 'this' allows you to access attributes of the instance
16 return moment(this.getDataValue('startDate')).format("YYYY-MM-DD HH:mm");
22 // 'this' allows you to access attributes of the instance
23 return moment(this.getDataValue('endDate')).format("YYYY-MM-DD HH:mm");
27 type: DataTypes.STRING,
28 defaultValue: 'Loading'
33 // 'this' allows you to access attributes of the instance
34 return moment(this.getDataValue('createdAt')).format("YYYY-MM-DD HH:mm:ss");
38 type: DataTypes.STRING,
39 defaultValue: 'manual'
41 UserId: DataTypes.INTEGER
43 tableName: 'analytics_extracted_reports',
44 associate: function(models) {
45 ExtractedReport.belongsTo(models.MailMessage);
49 return ExtractedReport;