joye-backend-utility 8.1.7 → 8.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,4 +99,10 @@ UserProfile.index({ employeeId: 1, date: -1, type: -1 }, {
99
99
  UserProfile.index({ employeeId: 1, week: -1, type: -1 }, {
100
100
  unique: false,
101
101
  });
102
+ // Analytics and profile lookups filter { employeeId, type } with no date.
103
+ // Without this compound, Cosmos cannot use (employeeId, date, type) and scans.
104
+ // Create this index in Cosmos Data Explorer if autoIndex is off.
105
+ UserProfile.index({ employeeId: 1, type: 1 }, {
106
+ unique: false,
107
+ });
102
108
  exports.UserProfileSchema = UserProfile;
@@ -35,6 +35,11 @@ const UserSuperPowerData = new mongoose_1.Schema({
35
35
  required: true,
36
36
  index: true,
37
37
  },
38
+ feature: {
39
+ type: String,
40
+ default: null,
41
+ index: true,
42
+ },
38
43
  resilienceIndex: {
39
44
  type: Number,
40
45
  required: true,
@@ -106,13 +111,21 @@ const UserSuperPowerData = new mongoose_1.Schema({
106
111
  type: mongoose_1.Schema.Types.Mixed,
107
112
  default: null,
108
113
  },
114
+ feature: {
115
+ type: String,
116
+ default: null,
117
+ },
109
118
  },
110
119
  required: false,
111
120
  default: () => ({
112
121
  inputPayload: null,
122
+ feature: null,
113
123
  }),
114
124
  },
115
125
  });
116
126
  UserSuperPowerData.index({ employeeId: 1, dimensionKey: 1 });
127
+ UserSuperPowerData.index({ employeeId: 1, year: 1, month: 1, feature: 1 });
117
128
  UserSuperPowerData.index({ date: -1 });
129
+ // Organization analytics queries { employeeId, date: { $in } }.
130
+ UserSuperPowerData.index({ employeeId: 1, date: -1 });
118
131
  exports.UserSuperPowerDataSchema = UserSuperPowerData;
@@ -19,6 +19,7 @@ const UserTrainingData = new mongoose_1.Schema({
19
19
  employeeId: {
20
20
  type: String,
21
21
  required: true,
22
+ index: true,
22
23
  },
23
24
  startWeek: {
24
25
  type: String,
@@ -94,4 +95,7 @@ const UserTrainingData = new mongoose_1.Schema({
94
95
  required: false,
95
96
  },
96
97
  });
98
+ // Organization analytics queries { employeeId, startDate: { $in } }.
99
+ // Create this index in Cosmos Data Explorer if autoIndex is off.
100
+ UserTrainingData.index({ employeeId: 1, startDate: -1 });
97
101
  exports.UserTrainingDataSchema = UserTrainingData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joye-backend-utility",
3
- "version": "8.1.7",
3
+ "version": "8.1.9",
4
4
  "description": "Joye backend utility for db functions and common functions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",