Skip to content

Commit 393465c

Browse files
authored
Merge pull request #531 from codex-team/feat/timestamp-index-repetition
feat(repetition): added index for timestamp of event
2 parents 75b10df + 4a16f52 commit 393465c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.2.11",
3+
"version": "1.2.12",
44
"main": "index.ts",
55
"license": "BUSL-1.1",
66
"scripts": {

src/resolvers/project.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const ProjectModel = require('../models/project').default;
1313
const EVENTS_GROUP_HASH_INDEX_NAME = 'groupHashUnique';
1414
const REPETITIONS_GROUP_HASH_INDEX_NAME = 'groupHash_hashed';
1515
const REPETITIONS_USER_ID_INDEX_NAME = 'userId';
16+
const EVENTS_TIMESTAMP_INDEX_NAME = 'timestamp';
1617
const MAX_SEARCH_QUERY_LENGTH = 50;
1718

1819
/**
@@ -124,6 +125,13 @@ module.exports = {
124125
sparse: true,
125126
});
126127

128+
await projectEventsCollection.createIndex({
129+
timestamp: 1,
130+
}, {
131+
name: EVENTS_TIMESTAMP_INDEX_NAME,
132+
sparse: true,
133+
});
134+
127135
telegram.sendMessage(`🤯 Project ${name} was created`);
128136

129137
return project;

0 commit comments

Comments
 (0)