database-connector 2.4.0 → 2.4.2

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.
@@ -69,7 +69,7 @@ const mongoose = require('mongoose');
69
69
  * description: Campaign objective - target followers, specific users, or all users
70
70
  * campaignPurpose:
71
71
  * type: string
72
- * enum: [increase_revenue, attract_new_clients, null]
72
+ * enum: [increase_revenue, attract_new_clients, both, null]
73
73
  * description: Campaign purpose (only when campaignObjective is 'all')
74
74
  * targetUserIds:
75
75
  * type: array
@@ -190,7 +190,7 @@ const FlashDealSchema = new mongoose.Schema(
190
190
  },
191
191
  campaignPurpose: {
192
192
  type: String,
193
- enum: ['increase_revenue', 'attract_new_clients', null],
193
+ enum: ['increase_revenue', 'attract_new_clients', 'both', null],
194
194
  default: null,
195
195
  },
196
196
  targetUserIds: [
package/models/Offer.js CHANGED
@@ -65,7 +65,7 @@ const mongoose = require('mongoose');
65
65
  * description: Who can see this offer
66
66
  * campaignPurpose:
67
67
  * type: string
68
- * enum: [increase_revenue, attract_new_clients, null]
68
+ * enum: [increase_revenue, attract_new_clients, both, null]
69
69
  * description: Campaign purpose (only when type is 'all')
70
70
  * userIds:
71
71
  * type: array
@@ -165,7 +165,7 @@ const OfferSchema = new mongoose.Schema(
165
165
  },
166
166
  campaignPurpose: {
167
167
  type: String,
168
- enum: ['increase_revenue', 'attract_new_clients', null],
168
+ enum: ['increase_revenue', 'attract_new_clients', 'both', null],
169
169
  default: null,
170
170
  },
171
171
  userIds: {
package/models/Payment.js CHANGED
@@ -47,6 +47,10 @@ const mongoose = require('mongoose');
47
47
  * type: string
48
48
  * nullable: true
49
49
  * description: Reference to payment method type (PaymentType)
50
+ * paymentDate:
51
+ * type: string
52
+ * format: date-time
53
+ * description: Payment date (defaults to current date/time)
50
54
  * token:
51
55
  * type: string
52
56
  * description: Payment token
@@ -65,6 +69,7 @@ const mongoose = require('mongoose');
65
69
  * paymentAmount: 150.00
66
70
  * paymentCurrency: "USD"
67
71
  * paymentMethodId: "507f1f77bcf86cd799439020"
72
+ * paymentDate: "2025-12-07T10:30:00.000Z"
68
73
  * createdAt: "2025-12-07T10:30:00.000Z"
69
74
  * updatedAt: "2025-12-07T10:30:00.000Z"
70
75
  */
@@ -106,6 +111,11 @@ const paymentSchema = new mongoose.Schema(
106
111
  default: null,
107
112
  ref: 'PaymentType',
108
113
  },
114
+ paymentDate: {
115
+ type: Date,
116
+ required: false,
117
+ default: Date.now,
118
+ },
109
119
  paymentDetails: {
110
120
  type: Object,
111
121
  required: true,
@@ -124,5 +134,6 @@ paymentSchema.index({ ownerId: 1, createdAt: -1 });
124
134
  paymentSchema.index({ paymentStatus: 1 });
125
135
  paymentSchema.index({ token: 1 });
126
136
  paymentSchema.index({ gateway: 1 });
137
+ paymentSchema.index({ paymentDate: -1 });
127
138
 
128
139
  module.exports = mongoose.model('Payment', paymentSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
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": {