database-connector 2.4.0 → 2.4.1

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.
Files changed (2) hide show
  1. package/models/Payment.js +11 -0
  2. package/package.json +1 -1
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.1",
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": {