3 module.exports = function(sequelize, DataTypes) {
5 var DefaultReport = sequelize.define('DefaultReport', {
6 name: DataTypes.STRING,
7 description: DataTypes.STRING,
8 parent: DataTypes.STRING,
9 table: DataTypes.STRING,
10 conditions: DataTypes.TEXT
12 tableName: 'analytics_default_reports',
13 associate: function(models) {
14 DefaultReport.hasMany(models.ReportField, {
19 DefaultReport.addScope('fields', {
21 model: models.ReportField,
24 attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'DefaultMetricId', 'format', 'custom'],
28 DefaultReport.addScope('exportFields', function(query) {
31 model: models.ReportField,
34 attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'DefaultMetricId', 'format', 'custom'],
36 model: models.DefaultMetric,
37 attributes: ['description', 'metric', 'name', 'table'],
40 model: models.ReportField,
42 attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'format'],