Skip to content

Commit 06a1859

Browse files
wip
1 parent b21770f commit 06a1859

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

modules/module-mongodb-storage/src/storage/MongoReportStorage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ function timeSpan(timeframe: event_types.TimeFrames): mongo.Filter<mongo.Documen
3232
const date = new Date();
3333
const { year, month, day, today } = parseDate(date);
3434
switch (timeframe) {
35-
case event_types.TimeFrames.MONTH: {
35+
case 'month': {
3636
// Cron should run the first day of the new month, this then retrieves from the 1st to the last day of the month
3737
const thisMonth = month;
3838
const nextMonth = month == 11 ? 0 : month + 1;
3939
return {
4040
connect_at: { $gte: new Date(year, thisMonth, 1, 0, 0, 0), $lte: new Date(year, nextMonth, 1, 0, 0, 0) }
4141
};
4242
}
43-
case event_types.TimeFrames.WEEK: {
43+
case 'week': {
4444
// Back tracks the date to the previous week Monday to Sunday
4545
const daysToSunday = 0 - day;
4646
const weekEndDate = new Date(date);

packages/types/src/events.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ export enum EmitterEngineEvents {
44
SDK_DELETE_OLD = 'sdk-delete-old'
55
}
66

7-
export enum TimeFrames {
8-
DAY = 'day',
9-
WEEK = 'week',
10-
MONTH = 'month'
11-
}
12-
7+
export type TimeFrames = 'day' | 'week' | 'month';
138
export type SubscribeEvents = {
149
[EmitterEngineEvents.SDK_CONNECT_EVENT]: SdkConnectEventData;
1510
[EmitterEngineEvents.SDK_DISCONNECT_EVENT]: SdkDisconnectEventData;

0 commit comments

Comments
 (0)