flykup_model_production 1.0.11 → 1.0.13
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/order.modal.js
CHANGED
|
@@ -17,6 +17,10 @@ const orderSchema = new mongoose.Schema(
|
|
|
17
17
|
required: true,
|
|
18
18
|
index: true
|
|
19
19
|
},
|
|
20
|
+
notificationSent: {
|
|
21
|
+
orderPlaced: { type: Boolean, default: false },
|
|
22
|
+
orderConfirmed: { type: Boolean, default: false }
|
|
23
|
+
},
|
|
20
24
|
products: [{
|
|
21
25
|
productId: {
|
|
22
26
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -61,16 +61,30 @@ const paymentSchema = new mongoose.Schema({
|
|
|
61
61
|
},
|
|
62
62
|
paymentMethod: String,
|
|
63
63
|
transactionTime: Date,
|
|
64
|
-
|
|
64
|
+
sellerPayments: [{
|
|
65
65
|
sellerId: {
|
|
66
66
|
type: mongoose.Schema.Types.ObjectId,
|
|
67
67
|
ref: 'users',
|
|
68
68
|
required: true
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
payableAmount: { // Amount for products only
|
|
71
|
+
type: Number,
|
|
72
|
+
required: true,
|
|
73
|
+
default: 0
|
|
74
|
+
},
|
|
75
|
+
deliveryCharge: { // Delivery fee for this seller's shipment
|
|
76
|
+
type: Number,
|
|
77
|
+
required: true,
|
|
78
|
+
default: 0
|
|
79
|
+
},
|
|
80
|
+
totalAmount: { // The sum of payableAmount + deliveryCharge
|
|
81
|
+
type: Number,
|
|
82
|
+
required: true,
|
|
83
|
+
default: 0
|
|
84
|
+
},
|
|
71
85
|
settlementStatus: {
|
|
72
86
|
type: String,
|
|
73
|
-
enum: ['PENDING', 'SETTLED','FAILED'],
|
|
87
|
+
enum: ['PENDING', 'SETTLED', 'FAILED'],
|
|
74
88
|
default: 'PENDING'
|
|
75
89
|
}
|
|
76
90
|
}]
|
|
@@ -80,7 +94,7 @@ const paymentSchema = new mongoose.Schema({
|
|
|
80
94
|
|
|
81
95
|
// Create indexes for better performance
|
|
82
96
|
paymentSchema.index({ razorpayOrderId: 1 });
|
|
83
|
-
paymentSchema.index({ cfOrderId: 1 });
|
|
97
|
+
// paymentSchema.index({ cfOrderId: 1 });
|
|
84
98
|
paymentSchema.index({ orderId: 1 });
|
|
85
99
|
|
|
86
100
|
// ❌ The pre-save middleware is no longer needed and should be removed.
|
|
@@ -191,7 +191,38 @@ isEligibleToPlay: {
|
|
|
191
191
|
type: Boolean,
|
|
192
192
|
default: false, // Default to true, can be set to false if video is not eligible for playback
|
|
193
193
|
index: true // Index for quick lookups
|
|
194
|
-
}
|
|
194
|
+
},
|
|
195
|
+
// Admin Approval Fields
|
|
196
|
+
approvalStatus: {
|
|
197
|
+
type: String,
|
|
198
|
+
enum: ['pending', 'approved', 'rejected'],
|
|
199
|
+
default: 'pending',
|
|
200
|
+
index: true
|
|
201
|
+
},
|
|
202
|
+
approvedBy: {
|
|
203
|
+
type: Schema.Types.ObjectId,
|
|
204
|
+
ref: 'Admin',
|
|
205
|
+
default: null
|
|
206
|
+
},
|
|
207
|
+
approvedAt: {
|
|
208
|
+
type: Date,
|
|
209
|
+
default: null
|
|
210
|
+
},
|
|
211
|
+
rejectionReason: {
|
|
212
|
+
type: String,
|
|
213
|
+
default: null,
|
|
214
|
+
trim: true
|
|
215
|
+
},
|
|
216
|
+
rejectedBy: {
|
|
217
|
+
type: Schema.Types.ObjectId,
|
|
218
|
+
ref: 'Admin',
|
|
219
|
+
default: null
|
|
220
|
+
},
|
|
221
|
+
rejectedAt: {
|
|
222
|
+
type: Date,
|
|
223
|
+
default: null
|
|
224
|
+
},
|
|
225
|
+
|
|
195
226
|
},
|
|
196
227
|
{ timestamps: true }
|
|
197
228
|
);
|