1- 'use strict'
1+ import { INTERVALS_DAILY , INTERVALS_MONTHLY , INTERVALS_YEARLY } from '../constants/intervals.js'
2+ import matchDomains from '../stages/matchDomains.js'
3+ import projectDuration from '../stages/projectDuration.js'
4+ import projectMinInterval from '../stages/projectMinInterval.js'
5+ import matchLimit from '../stages/matchLimit.js'
26
3- const intervals = require ( '../constants/intervals' )
4- const matchDomains = require ( '../stages/matchDomains' )
5- const projectDuration = require ( '../stages/projectDuration' )
6- const projectMinInterval = require ( '../stages/projectMinInterval' )
7- const matchLimit = require ( '../stages/matchLimit' )
8-
9- module . exports = ( ids , interval , limit , dateDetails ) => {
7+ export default ( ids , interval , limit , dateDetails ) => {
108 const aggregation = [
119 matchDomains ( ids ) ,
1210 projectDuration ( ) ,
@@ -25,9 +23,9 @@ module.exports = (ids, interval, limit, dateDetails) => {
2523 aggregation [ 0 ] . $match . created = { $gte : dateDetails . includeFnByInterval ( interval ) ( limit ) }
2624
2725 const dateExpression = { date : '$created' , timezone : dateDetails . userTimeZone }
28- const matchDay = [ intervals . INTERVALS_DAILY ] . includes ( interval )
29- const matchMonth = [ intervals . INTERVALS_DAILY , intervals . INTERVALS_MONTHLY ] . includes ( interval )
30- const matchYear = [ intervals . INTERVALS_DAILY , intervals . INTERVALS_MONTHLY , intervals . INTERVALS_YEARLY ] . includes ( interval )
26+ const matchDay = [ INTERVALS_DAILY ] . includes ( interval )
27+ const matchMonth = [ INTERVALS_DAILY , INTERVALS_MONTHLY ] . includes ( interval )
28+ const matchYear = [ INTERVALS_DAILY , INTERVALS_MONTHLY , INTERVALS_YEARLY ] . includes ( interval )
3129
3230 if ( matchDay === true ) aggregation [ 4 ] . $group . _id . day = { $dayOfMonth : dateExpression }
3331 if ( matchMonth === true ) aggregation [ 4 ] . $group . _id . month = { $month : dateExpression }
0 commit comments