flykup_model_development 3.1.75 → 3.1.76

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 (42) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/workflows/main.yml +30 -0
  3. package/.github/workflows/publish.yml +31 -0
  4. package/auth.js +14 -14
  5. package/config.js +1 -1
  6. package/db_connection.js +23 -23
  7. package/index.js +140 -140
  8. package/models/AadhaarVerification.js +131 -131
  9. package/models/AdminEmail.model.js +39 -38
  10. package/models/BankVerification.js +92 -92
  11. package/models/GSTVerification.js +89 -89
  12. package/models/LiveStreamInteraction.model.js +101 -101
  13. package/models/ProductInteraction.model.js +108 -108
  14. package/models/Review.model.js +121 -121
  15. package/models/SearchAnalytics.js +23 -23
  16. package/models/ShoppableInteraction.model.js +106 -106
  17. package/models/Wishlist.model.js +29 -29
  18. package/models/admin.model.js +42 -42
  19. package/models/appUpdate.model.js +19 -19
  20. package/models/assets.model.js +32 -32
  21. package/models/blockedRegion.models.js +27 -27
  22. package/models/chat.model.js +511 -511
  23. package/models/coHostInvitation.model.js +60 -60
  24. package/models/follow.model.js +38 -38
  25. package/models/loginlogs.model.js +26 -26
  26. package/models/notification.model.js +129 -129
  27. package/models/order.modal.js +386 -386
  28. package/models/orderPayment.model.js +218 -218
  29. package/models/productListing.model.js +322 -322
  30. package/models/profileInteractions.model.js +44 -44
  31. package/models/registerShow.model.js +29 -29
  32. package/models/sellerDraft.model.js +27 -27
  33. package/models/shipper.model.js +126 -126
  34. package/models/shoppableVideo.model.js +237 -237
  35. package/models/shoppableVideoComment.model.js +57 -57
  36. package/models/shoppableVideoLike.model.js +29 -29
  37. package/models/shoppableVideoSave.model.js +27 -27
  38. package/models/shows.model.js +604 -604
  39. package/models/stock.model.js +105 -105
  40. package/models/ticket.model.js +115 -115
  41. package/package.json +19 -19
  42. package/test.html +11 -11
@@ -1,219 +1,219 @@
1
- import mongoose from 'mongoose';
2
-
3
- const paymentSchema = new mongoose.Schema({
4
- orderId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: 'Order',
7
- required: true
8
- },
9
- userId: {
10
- type: mongoose.Schema.Types.ObjectId,
11
- ref: 'users',
12
- required: true
13
- },
14
- paymentGateway: {
15
- type: String,
16
- enum: ['RAZORPAY', 'CASHFREE'],
17
- required: true
18
- },
19
-
20
- // Razorpay-specific fields
21
- razorpayOrderId: {
22
- type: String,
23
- // ✅ This field is now required only if the gateway is RAZORPAY
24
- required: function() {
25
- return this.paymentGateway === 'RAZORPAY';
26
- }
27
- },
28
- razorpayPaymentId: {
29
- type: String,
30
- default: null
31
- },
32
-
33
- // Cashfree-specific fields
34
- cfPaymentSessionId: {
35
- type: String,
36
- // ✅ This field is now required only if the gateway is CASHFREE
37
- required: function() {
38
- return this.paymentGateway === 'CASHFREE';
39
- }
40
- },
41
- cfOrderId: {
42
- type: String,
43
- // ✅ This field is now required only if the gateway is CASHFREE
44
- required: function() {
45
- return this.paymentGateway === 'CASHFREE';
46
- }
47
- },
48
-
49
- amount: {
50
- type: Number,
51
- required: true
52
- },
53
- currency: {
54
- type: String,
55
- default: 'INR'
56
- },
57
- status: {
58
- type: String,
59
- enum: ['PENDING', 'SUCCESS', 'FAILED', 'REFUNDED'],
60
- default: 'PENDING'
61
- },
62
- paymentMethod: String,
63
- transactionTime: Date,
64
-
65
- // ✅ SELLER PAYMENTS FIELD - Now matching package model
66
- sellerPayments: [{
67
- sellerId: {
68
- type: mongoose.Schema.Types.ObjectId,
69
- ref: 'users',
70
- required: true
71
- },
72
- payableAmount: { // Amount for products only
73
- type: Number,
74
- required: true,
75
- default: 0
76
- },
77
- deliveryCharge: { // Delivery fee for this seller's shipment
78
- type: Number,
79
- required: true,
80
- default: 0
81
- },
82
- totalAmount: { // The sum of payableAmount + deliveryCharge
83
- type: Number,
84
- required: true,
85
- default: 0
86
- },
87
- settlementStatus: {
88
- type: String,
89
- enum: ['PENDING', 'SETTLED', 'FAILED'],
90
- default: 'PENDING'
91
- }
92
- }]
93
- }, {
94
- timestamps: true
95
- });
96
-
97
- // Create indexes for better performance
98
- paymentSchema.index({ razorpayOrderId: 1 });
99
- paymentSchema.index({ orderId: 1 });
100
-
101
- const OrderPayment =
102
- mongoose.models.OrderPayment || mongoose.model('orderPayment', paymentSchema);
103
-
104
- export default OrderPayment;
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
- // import mongoose from 'mongoose';
116
-
117
- // const paymentSchema = new mongoose.Schema({
118
- // orderId: {
119
- // type: mongoose.Schema.Types.ObjectId,
120
- // ref: 'Order',
121
- // required: true
122
- // },
123
- // userId: {
124
- // type: mongoose.Schema.Types.ObjectId,
125
- // ref: 'users',
126
- // required: true
127
- // },
128
- // paymentGateway: {
129
- // type: String,
130
- // enum: ['RAZORPAY', 'CASHFREE'],
131
- // required: true
132
- // },
133
-
134
- // // Razorpay-specific fields
135
- // razorpayOrderId: {
136
- // type: String,
137
- // // ✅ This field is now required only if the gateway is RAZORPAY
138
- // required: function() {
139
- // return this.paymentGateway === 'RAZORPAY';
140
- // }
141
- // },
142
- // razorpayPaymentId: {
143
- // type: String,
144
- // default: null
145
- // },
146
-
147
- // // Cashfree-specific fields
148
- // cfPaymentSessionId: {
149
- // type: String,
150
- // // ✅ This field is now required only if the gateway is CASHFREE
151
- // required: function() {
152
- // return this.paymentGateway === 'CASHFREE';
153
- // }
154
- // },
155
- // cfOrderId: {
156
- // type: String,
157
- // // ✅ This field is now required only if the gateway is CASHFREE
158
- // required: function() {
159
- // return this.paymentGateway === 'CASHFREE';
160
- // }
161
- // },
162
-
163
- // amount: {
164
- // type: Number,
165
- // required: true
166
- // },
167
- // currency: {
168
- // type: String,
169
- // default: 'INR'
170
- // },
171
- // status: {
172
- // type: String,
173
- // enum: ['PENDING', 'SUCCESS', 'FAILED', 'REFUNDED'],
174
- // default: 'PENDING'
175
- // },
176
- // paymentMethod: String,
177
- // transactionTime: Date,
178
- // sellerPayments: [{
179
- // sellerId: {
180
- // type: mongoose.Schema.Types.ObjectId,
181
- // ref: 'users',
182
- // required: true
183
- // },
184
- // payableAmount: { // Amount for products only
185
- // type: Number,
186
- // required: true,
187
- // default: 0
188
- // },
189
- // deliveryCharge: { // Delivery fee for this seller's shipment
190
- // type: Number,
191
- // required: true,
192
- // default: 0
193
- // },
194
- // totalAmount: { // The sum of payableAmount + deliveryCharge
195
- // type: Number,
196
- // required: true,
197
- // default: 0
198
- // },
199
- // settlementStatus: {
200
- // type: String,
201
- // enum: ['PENDING', 'SETTLED', 'FAILED'],
202
- // default: 'PENDING'
203
- // }
204
- // }]
205
- // }, {
206
- // timestamps: true
207
- // });
208
-
209
- // // Create indexes for better performance
210
- // paymentSchema.index({ razorpayOrderId: 1 });
211
- // // paymentSchema.index({ cfOrderId: 1 });
212
- // paymentSchema.index({ orderId: 1 });
213
-
214
- // // ❌ The pre-save middleware is no longer needed and should be removed.
215
-
216
- // const OrderPayment =
217
- // mongoose.models.OrderPayment || mongoose.model('orderPayment', paymentSchema);
218
-
1
+ import mongoose from 'mongoose';
2
+
3
+ const paymentSchema = new mongoose.Schema({
4
+ orderId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: 'Order',
7
+ required: true
8
+ },
9
+ userId: {
10
+ type: mongoose.Schema.Types.ObjectId,
11
+ ref: 'users',
12
+ required: true
13
+ },
14
+ paymentGateway: {
15
+ type: String,
16
+ enum: ['RAZORPAY', 'CASHFREE'],
17
+ required: true
18
+ },
19
+
20
+ // Razorpay-specific fields
21
+ razorpayOrderId: {
22
+ type: String,
23
+ // ✅ This field is now required only if the gateway is RAZORPAY
24
+ required: function() {
25
+ return this.paymentGateway === 'RAZORPAY';
26
+ }
27
+ },
28
+ razorpayPaymentId: {
29
+ type: String,
30
+ default: null
31
+ },
32
+
33
+ // Cashfree-specific fields
34
+ cfPaymentSessionId: {
35
+ type: String,
36
+ // ✅ This field is now required only if the gateway is CASHFREE
37
+ required: function() {
38
+ return this.paymentGateway === 'CASHFREE';
39
+ }
40
+ },
41
+ cfOrderId: {
42
+ type: String,
43
+ // ✅ This field is now required only if the gateway is CASHFREE
44
+ required: function() {
45
+ return this.paymentGateway === 'CASHFREE';
46
+ }
47
+ },
48
+
49
+ amount: {
50
+ type: Number,
51
+ required: true
52
+ },
53
+ currency: {
54
+ type: String,
55
+ default: 'INR'
56
+ },
57
+ status: {
58
+ type: String,
59
+ enum: ['PENDING', 'SUCCESS', 'FAILED', 'REFUNDED'],
60
+ default: 'PENDING'
61
+ },
62
+ paymentMethod: String,
63
+ transactionTime: Date,
64
+
65
+ // ✅ SELLER PAYMENTS FIELD - Now matching package model
66
+ sellerPayments: [{
67
+ sellerId: {
68
+ type: mongoose.Schema.Types.ObjectId,
69
+ ref: 'users',
70
+ required: true
71
+ },
72
+ payableAmount: { // Amount for products only
73
+ type: Number,
74
+ required: true,
75
+ default: 0
76
+ },
77
+ deliveryCharge: { // Delivery fee for this seller's shipment
78
+ type: Number,
79
+ required: true,
80
+ default: 0
81
+ },
82
+ totalAmount: { // The sum of payableAmount + deliveryCharge
83
+ type: Number,
84
+ required: true,
85
+ default: 0
86
+ },
87
+ settlementStatus: {
88
+ type: String,
89
+ enum: ['PENDING', 'SETTLED', 'FAILED'],
90
+ default: 'PENDING'
91
+ }
92
+ }]
93
+ }, {
94
+ timestamps: true
95
+ });
96
+
97
+ // Create indexes for better performance
98
+ paymentSchema.index({ razorpayOrderId: 1 });
99
+ paymentSchema.index({ orderId: 1 });
100
+
101
+ const OrderPayment =
102
+ mongoose.models.OrderPayment || mongoose.model('orderPayment', paymentSchema);
103
+
104
+ export default OrderPayment;
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ // import mongoose from 'mongoose';
116
+
117
+ // const paymentSchema = new mongoose.Schema({
118
+ // orderId: {
119
+ // type: mongoose.Schema.Types.ObjectId,
120
+ // ref: 'Order',
121
+ // required: true
122
+ // },
123
+ // userId: {
124
+ // type: mongoose.Schema.Types.ObjectId,
125
+ // ref: 'users',
126
+ // required: true
127
+ // },
128
+ // paymentGateway: {
129
+ // type: String,
130
+ // enum: ['RAZORPAY', 'CASHFREE'],
131
+ // required: true
132
+ // },
133
+
134
+ // // Razorpay-specific fields
135
+ // razorpayOrderId: {
136
+ // type: String,
137
+ // // ✅ This field is now required only if the gateway is RAZORPAY
138
+ // required: function() {
139
+ // return this.paymentGateway === 'RAZORPAY';
140
+ // }
141
+ // },
142
+ // razorpayPaymentId: {
143
+ // type: String,
144
+ // default: null
145
+ // },
146
+
147
+ // // Cashfree-specific fields
148
+ // cfPaymentSessionId: {
149
+ // type: String,
150
+ // // ✅ This field is now required only if the gateway is CASHFREE
151
+ // required: function() {
152
+ // return this.paymentGateway === 'CASHFREE';
153
+ // }
154
+ // },
155
+ // cfOrderId: {
156
+ // type: String,
157
+ // // ✅ This field is now required only if the gateway is CASHFREE
158
+ // required: function() {
159
+ // return this.paymentGateway === 'CASHFREE';
160
+ // }
161
+ // },
162
+
163
+ // amount: {
164
+ // type: Number,
165
+ // required: true
166
+ // },
167
+ // currency: {
168
+ // type: String,
169
+ // default: 'INR'
170
+ // },
171
+ // status: {
172
+ // type: String,
173
+ // enum: ['PENDING', 'SUCCESS', 'FAILED', 'REFUNDED'],
174
+ // default: 'PENDING'
175
+ // },
176
+ // paymentMethod: String,
177
+ // transactionTime: Date,
178
+ // sellerPayments: [{
179
+ // sellerId: {
180
+ // type: mongoose.Schema.Types.ObjectId,
181
+ // ref: 'users',
182
+ // required: true
183
+ // },
184
+ // payableAmount: { // Amount for products only
185
+ // type: Number,
186
+ // required: true,
187
+ // default: 0
188
+ // },
189
+ // deliveryCharge: { // Delivery fee for this seller's shipment
190
+ // type: Number,
191
+ // required: true,
192
+ // default: 0
193
+ // },
194
+ // totalAmount: { // The sum of payableAmount + deliveryCharge
195
+ // type: Number,
196
+ // required: true,
197
+ // default: 0
198
+ // },
199
+ // settlementStatus: {
200
+ // type: String,
201
+ // enum: ['PENDING', 'SETTLED', 'FAILED'],
202
+ // default: 'PENDING'
203
+ // }
204
+ // }]
205
+ // }, {
206
+ // timestamps: true
207
+ // });
208
+
209
+ // // Create indexes for better performance
210
+ // paymentSchema.index({ razorpayOrderId: 1 });
211
+ // // paymentSchema.index({ cfOrderId: 1 });
212
+ // paymentSchema.index({ orderId: 1 });
213
+
214
+ // // ❌ The pre-save middleware is no longer needed and should be removed.
215
+
216
+ // const OrderPayment =
217
+ // mongoose.models.OrderPayment || mongoose.model('orderPayment', paymentSchema);
218
+
219
219
  // export default OrderPayment;