database-connector 2.4.9 → 2.4.11
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.
- package/models/Subscription.js +5 -1
- package/package.json +1 -1
package/models/Subscription.js
CHANGED
|
@@ -428,8 +428,12 @@ const subscriptionSchema = new mongoose.Schema(
|
|
|
428
428
|
);
|
|
429
429
|
|
|
430
430
|
// Auto-record history snapshots to embedded subscriptionsHistory array
|
|
431
|
-
subscriptionSchema.post('save', async function (doc) {
|
|
431
|
+
subscriptionSchema.post('save', async function (doc, next) {
|
|
432
|
+
// For save operations, check the $locals property where custom options are stored
|
|
433
|
+
if (doc.$locals && doc.$locals.skipHistory) return next();
|
|
434
|
+
if (this.$locals && this.$locals.skipHistory) return next();
|
|
432
435
|
await recordSubscriptionHistory(doc);
|
|
436
|
+
next();
|
|
433
437
|
});
|
|
434
438
|
|
|
435
439
|
subscriptionSchema.post('findOneAndUpdate', async function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "database-connector",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.11",
|
|
4
4
|
"description": "MongoDB models package with Mongoose schemas for e-commerce applications. Includes User, Product, Store, Order and more with built-in validation and virtual properties.",
|
|
5
5
|
"main": "models/index.js",
|
|
6
6
|
"scripts": {
|