database-connector 2.3.13 → 2.4.0
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/Payment.js +3 -39
- package/package.json +1 -1
package/models/Payment.js
CHANGED
|
@@ -11,8 +11,6 @@ const mongoose = require('mongoose');
|
|
|
11
11
|
* - paymentStatus
|
|
12
12
|
* - paymentAmount
|
|
13
13
|
* - paymentCurrency
|
|
14
|
-
* - paymentDate
|
|
15
|
-
* - paymentTime
|
|
16
14
|
* - paymentDetails
|
|
17
15
|
* - token
|
|
18
16
|
* properties:
|
|
@@ -49,18 +47,6 @@ const mongoose = require('mongoose');
|
|
|
49
47
|
* type: string
|
|
50
48
|
* nullable: true
|
|
51
49
|
* description: Reference to payment method type (PaymentType)
|
|
52
|
-
* paymentDate:
|
|
53
|
-
* type: string
|
|
54
|
-
* format: date
|
|
55
|
-
* description: Date of payment
|
|
56
|
-
* paymentTime:
|
|
57
|
-
* type: string
|
|
58
|
-
* format: date-time
|
|
59
|
-
* description: Time of payment
|
|
60
|
-
* totalPrice:
|
|
61
|
-
* type: number
|
|
62
|
-
* default: 0
|
|
63
|
-
* description: Total price
|
|
64
50
|
* token:
|
|
65
51
|
* type: string
|
|
66
52
|
* description: Payment token
|
|
@@ -75,11 +61,10 @@ const mongoose = require('mongoose');
|
|
|
75
61
|
* creatorId: "507f1f77bcf86cd799439012"
|
|
76
62
|
* ownerId: "507f1f77bcf86cd799439013"
|
|
77
63
|
* gateway: "Stripe"
|
|
78
|
-
* paymentStatus: "
|
|
64
|
+
* paymentStatus: "completed"
|
|
79
65
|
* paymentAmount: 150.00
|
|
80
66
|
* paymentCurrency: "USD"
|
|
81
67
|
* paymentMethodId: "507f1f77bcf86cd799439020"
|
|
82
|
-
* totalPrice: 150.00
|
|
83
68
|
* createdAt: "2025-12-07T10:30:00.000Z"
|
|
84
69
|
* updatedAt: "2025-12-07T10:30:00.000Z"
|
|
85
70
|
*/
|
|
@@ -101,7 +86,6 @@ const paymentSchema = new mongoose.Schema(
|
|
|
101
86
|
type: String,
|
|
102
87
|
required: true,
|
|
103
88
|
},
|
|
104
|
-
|
|
105
89
|
paymentStatus: {
|
|
106
90
|
type: String,
|
|
107
91
|
required: true,
|
|
@@ -122,33 +106,14 @@ const paymentSchema = new mongoose.Schema(
|
|
|
122
106
|
default: null,
|
|
123
107
|
ref: 'PaymentType',
|
|
124
108
|
},
|
|
125
|
-
paymentDate: {
|
|
126
|
-
type: Date,
|
|
127
|
-
required: true,
|
|
128
|
-
},
|
|
129
|
-
paymentTime: {
|
|
130
|
-
type: Date,
|
|
131
|
-
required: true,
|
|
132
|
-
},
|
|
133
109
|
paymentDetails: {
|
|
134
110
|
type: Object,
|
|
135
111
|
required: true,
|
|
136
112
|
},
|
|
137
|
-
totalPrice: {
|
|
138
|
-
type: Number,
|
|
139
|
-
required: true,
|
|
140
|
-
default: 0,
|
|
141
|
-
},
|
|
142
|
-
// transactions field removed: Transactions are no longer tracked as a separate model
|
|
143
|
-
timestamps: {
|
|
144
|
-
type: Date,
|
|
145
|
-
required: true,
|
|
146
|
-
default: Date.now()
|
|
147
|
-
},
|
|
148
113
|
token: {
|
|
149
114
|
type: String,
|
|
150
|
-
required: true
|
|
151
|
-
}
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
152
117
|
},
|
|
153
118
|
{ timestamps: true }
|
|
154
119
|
);
|
|
@@ -159,6 +124,5 @@ paymentSchema.index({ ownerId: 1, createdAt: -1 });
|
|
|
159
124
|
paymentSchema.index({ paymentStatus: 1 });
|
|
160
125
|
paymentSchema.index({ token: 1 });
|
|
161
126
|
paymentSchema.index({ gateway: 1 });
|
|
162
|
-
paymentSchema.index({ paymentDate: -1 });
|
|
163
127
|
|
|
164
128
|
module.exports = mongoose.model('Payment', paymentSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "database-connector",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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": {
|