@grapadigital/shared-schemas 2.2.1 → 2.2.3

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.
@@ -67,4 +67,5 @@ exports.Contract = Contract = __decorate([
67
67
  (0, mongoose_1.Schema)({ timestamps: true })
68
68
  ], Contract);
69
69
  exports.ContractSchema = mongoose_1.SchemaFactory.createForClass(Contract);
70
+ exports.ContractSchema.index({ recruitment: 1 });
70
71
  exports.ContractModel = (0, mongoose_2.model)("Contract", exports.ContractSchema);
@@ -87,4 +87,5 @@ exports.Notification = Notification = __decorate([
87
87
  (0, mongoose_1.Schema)({ timestamps: true, collection: "notifications" })
88
88
  ], Notification);
89
89
  exports.NotificationSchema = mongoose_1.SchemaFactory.createForClass(Notification);
90
+ exports.NotificationSchema.index({ "recipient.username": 1, read: 1, createdAt: -1 });
90
91
  exports.NotificationModel = (0, mongoose_2.model)("Notification", exports.NotificationSchema);
@@ -201,4 +201,18 @@ exports.TaskSchema.index({ organization: 1 });
201
201
  exports.TaskSchema.index({ businessUnit: 1 });
202
202
  exports.TaskSchema.index({ "storeVisit.token": 1 }, { unique: true, sparse: true });
203
203
  exports.TaskSchema.index({ "storeVisit.store": 1 }, { sparse: true });
204
+ exports.TaskSchema.index({
205
+ "storeVisit.store": 1,
206
+ "storeVisit.scheduledDate": 1,
207
+ "storeVisit.scheduledPeriod": 1,
208
+ }, {
209
+ unique: true,
210
+ partialFilterExpression: {
211
+ type: "store_visit",
212
+ status: { $ne: "cancelled" },
213
+ "storeVisit.store": { $exists: true },
214
+ "storeVisit.scheduledDate": { $exists: true },
215
+ "storeVisit.scheduledPeriod": { $exists: true },
216
+ },
217
+ });
204
218
  exports.TaskModel = (0, mongoose_2.model)("Task", exports.TaskSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",