joye-backend-utility 8.1.8 → 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;
@@ -126,4 +126,6 @@ const UserSuperPowerData = new mongoose_1.Schema({
126
126
  UserSuperPowerData.index({ employeeId: 1, dimensionKey: 1 });
127
127
  UserSuperPowerData.index({ employeeId: 1, year: 1, month: 1, feature: 1 });
128
128
  UserSuperPowerData.index({ date: -1 });
129
+ // Organization analytics queries { employeeId, date: { $in } }.
130
+ UserSuperPowerData.index({ employeeId: 1, date: -1 });
129
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.8",
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",