joye-backend-utility 8.2.3 → 8.2.5
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.
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
+
/** Tenant identity is scoped per platform — same tId may exist on different platforms. */
|
|
2
3
|
export declare const OrganizationSchema: Schema<import("mongoose").Document<any, any, any>, import("mongoose").Model<import("mongoose").Document<any, any, any>, any, any>, undefined, {}>;
|
|
@@ -76,4 +76,6 @@ const Organization = new mongoose_1.Schema({
|
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
Organization.index({ platformKey: 1, timezone: -1, inactive: -1 });
|
|
79
|
+
/** Tenant identity is scoped per platform — same tId may exist on different platforms. */
|
|
80
|
+
// Organization.index({ platformKey: 1, tId: 1 }, { unique: true });
|
|
79
81
|
exports.OrganizationSchema = Organization;
|
|
@@ -152,6 +152,14 @@ const UserAnalytic = new mongoose_1.Schema({
|
|
|
152
152
|
type: String,
|
|
153
153
|
required: false,
|
|
154
154
|
},
|
|
155
|
+
/**
|
|
156
|
+
* True on this employee + week/year row when generation hit a safety situation
|
|
157
|
+
* (model paused the routine wellness plan). Cleared when a later generation for the same row returns a normal plan.
|
|
158
|
+
*/
|
|
159
|
+
safetySituation: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
required: false,
|
|
162
|
+
},
|
|
155
163
|
/** Set when batch path failed/timed out and sync/fallback was used. */
|
|
156
164
|
aiInsightsBatchError: {
|
|
157
165
|
type: String,
|
|
@@ -201,4 +209,7 @@ UserAnalytic.index({ employeeId: 1, weekNumber: -1, year: -1, date: -1 });
|
|
|
201
209
|
UserAnalytic.index({ employeeId: 1, month: -1, year: -1, date: -1 });
|
|
202
210
|
UserAnalytic.index({ year: 1, weekNumber: 1, bucket: 1, _id: 1 });
|
|
203
211
|
UserAnalytic.index({ year: 1, weekNumber: 1, hasDailySuggestion: 1, bucket: 1, _id: 1 });
|
|
212
|
+
// Suggestion-queue filter is year + weekNumber + hasDailySuggestion + tz + bucket, paged by _id.
|
|
213
|
+
// db.user_analytics.createIndex({ year: 1, weekNumber: 1, hasDailySuggestion: 1, tz: 1, bucket: 1, _id: 1 }, { name: 'year_week_hasDI_tz_bucket_id' })
|
|
214
|
+
UserAnalytic.index({ year: 1, weekNumber: 1, hasDailySuggestion: 1, tz: 1, bucket: 1, _id: 1 }, { name: 'year_week_hasDI_tz_bucket_id' });
|
|
204
215
|
exports.UserAnalyticSchema = UserAnalytic;
|