model: models.ReportField,
as: 'Fields',
required: false,
- attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'MetricId']
+ attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'MetricId', 'format', 'custom'],
}]
});
+
+ CustomReport.addScope('exportFields', function(query) {
+ return {
+ include: [{
+ model: models.ReportField,
+ as: 'Fields',
+ required: false,
+ attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'MetricId', 'format', 'custom'],
+ include: [{
+ model: models.Metric,
+ attributes: ['description', 'metric', 'name', 'table'],
+ required: false,
+ include: [{
+ model: models.ReportField,
+ as: 'ReportFields',
+ attributes: ['field', 'alias', 'function', 'groupBy', 'orderBy', 'format'],
+ required: false,
+ where: query
+ }],
+ }]
+ }]
+ };
+ });
}
});