flykup_model_development 3.1.27 → 3.1.29
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/BankVerification.js +10 -0
- package/models/order.modal.js +1 -353
- package/models/productListing.model.js +15 -1
- package/models/stock.model.js +0 -40
- package/package.json +1 -1
|
@@ -8,6 +8,16 @@ const bankVerificationSchema = new mongoose.Schema({
|
|
|
8
8
|
required: true,
|
|
9
9
|
unique: true, // Ensures only one bank verification per user
|
|
10
10
|
index: true
|
|
11
|
+
},
|
|
12
|
+
sellerId: {
|
|
13
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
14
|
+
ref: 'sellers',
|
|
15
|
+
|
|
16
|
+
},
|
|
17
|
+
role: {
|
|
18
|
+
type: String,
|
|
19
|
+
enum: ['user', 'seller', 'admin'],
|
|
20
|
+
|
|
11
21
|
},
|
|
12
22
|
accountNumber: {
|
|
13
23
|
type: String,
|
package/models/order.modal.js
CHANGED
|
@@ -1,355 +1,3 @@
|
|
|
1
|
-
// // order.model.js - CORRECTED SCHEMA STRUCTURE
|
|
2
|
-
// import mongoose from 'mongoose';
|
|
3
|
-
// import { nanoid } from 'nanoid';
|
|
4
|
-
|
|
5
|
-
// const orderSchema = new mongoose.Schema(
|
|
6
|
-
// {
|
|
7
|
-
// orderId: {
|
|
8
|
-
// type: String,
|
|
9
|
-
// required: true,
|
|
10
|
-
// unique: true,
|
|
11
|
-
// default: () => `FLY-ORD-${nanoid(8)}`
|
|
12
|
-
// },
|
|
13
|
-
// userId: {
|
|
14
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
15
|
-
// ref: 'users',
|
|
16
|
-
// required: true,
|
|
17
|
-
// index: true
|
|
18
|
-
// },
|
|
19
|
-
// products: [{
|
|
20
|
-
// productId: {
|
|
21
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
22
|
-
// ref: 'productlistings',
|
|
23
|
-
// required: true
|
|
24
|
-
// },
|
|
25
|
-
// sellerUserId: {
|
|
26
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
27
|
-
// ref: 'users',
|
|
28
|
-
// required: true
|
|
29
|
-
// },
|
|
30
|
-
// quantity: {
|
|
31
|
-
// type: Number,
|
|
32
|
-
// required: true,
|
|
33
|
-
// min: 1
|
|
34
|
-
// },
|
|
35
|
-
// basePrice: {
|
|
36
|
-
// type: Number,
|
|
37
|
-
// required: true
|
|
38
|
-
// },
|
|
39
|
-
// gstRate: {
|
|
40
|
-
// type: Number,
|
|
41
|
-
// required: true
|
|
42
|
-
// },
|
|
43
|
-
// gstAmount: {
|
|
44
|
-
// type: Number,
|
|
45
|
-
// required: true
|
|
46
|
-
// },
|
|
47
|
-
// gstType: {
|
|
48
|
-
// type: String,
|
|
49
|
-
// enum: ['CGST+SGST', 'IGST',"NON-GST"],
|
|
50
|
-
// required: true
|
|
51
|
-
// }
|
|
52
|
-
// }],
|
|
53
|
-
// totalBaseAmount: {
|
|
54
|
-
// type: Number,
|
|
55
|
-
// required: true
|
|
56
|
-
// },
|
|
57
|
-
// totalGstAmount: {
|
|
58
|
-
// type: Number,
|
|
59
|
-
// required: true
|
|
60
|
-
// },
|
|
61
|
-
// totalAmount: {
|
|
62
|
-
// type: Number,
|
|
63
|
-
// required: true
|
|
64
|
-
// },
|
|
65
|
-
// gstSplit: {
|
|
66
|
-
// cgst: {
|
|
67
|
-
// rate: Number,
|
|
68
|
-
// amount: Number
|
|
69
|
-
// },
|
|
70
|
-
// sgst: {
|
|
71
|
-
// rate: Number,
|
|
72
|
-
// amount: Number
|
|
73
|
-
// },
|
|
74
|
-
// igst: {
|
|
75
|
-
// rate: Number,
|
|
76
|
-
// amount: Number
|
|
77
|
-
// }
|
|
78
|
-
// },
|
|
79
|
-
// deliveryAddress: {
|
|
80
|
-
// name: { type: String, maxLength: 50, trim: true, required: true },
|
|
81
|
-
// mobile: { type: String, trim: true, maxLength: 15, required: true },
|
|
82
|
-
// alternateMobile: { type: String, trim: true, maxLength: 15, default: null },
|
|
83
|
-
// line1: { type: String, trim: true, maxLength: 100, required: true },
|
|
84
|
-
// line2: { type: String, trim: true, maxLength: 100, default: "" },
|
|
85
|
-
// city: { type: String, trim: true, maxLength: 50, required: true },
|
|
86
|
-
// state: { type: String, trim: true, maxLength: 50, required: true },
|
|
87
|
-
// pincode: { type: String, maxLength: 6, trim: true, required: true },
|
|
88
|
-
// addressType: {
|
|
89
|
-
// type: String,
|
|
90
|
-
// enum: ['home', 'work', 'other'],
|
|
91
|
-
// default: 'home'
|
|
92
|
-
// },
|
|
93
|
-
// addressModified: {
|
|
94
|
-
// type: Boolean,
|
|
95
|
-
// default: false
|
|
96
|
-
// },
|
|
97
|
-
// addressModifiedAt: {
|
|
98
|
-
// type: Date,
|
|
99
|
-
// default: null
|
|
100
|
-
// }
|
|
101
|
-
// },
|
|
102
|
-
// // CORRECT PLACEMENT - TOP LEVEL FIELDS
|
|
103
|
-
// logisticsDetails: {
|
|
104
|
-
// shipmentMethod: {
|
|
105
|
-
// type: String,
|
|
106
|
-
// enum: ['self_shipment', 'flykup_logistics'],
|
|
107
|
-
// default: 'flykup_logistics'
|
|
108
|
-
// },
|
|
109
|
-
// awbNumber: String,
|
|
110
|
-
// carrier: String,
|
|
111
|
-
// carrierId: String,
|
|
112
|
-
// trackingNumber: String,
|
|
113
|
-
// trackingUrl: String,
|
|
114
|
-
// expectedDeliveryDate: Date,
|
|
115
|
-
// shipmentBookedAt: Date,
|
|
116
|
-
// logisticsResponse: mongoose.Schema.Types.Mixed,
|
|
117
|
-
// shipmentBookingStatus: {
|
|
118
|
-
// type: String,
|
|
119
|
-
// enum: ['pending', 'booked', 'failed'],
|
|
120
|
-
// default: 'pending'
|
|
121
|
-
// },
|
|
122
|
-
// shipmentBookingError: String,
|
|
123
|
-
// multipleSellers: {
|
|
124
|
-
// type: Boolean,
|
|
125
|
-
// default: false
|
|
126
|
-
// },
|
|
127
|
-
// selectedCourier: {
|
|
128
|
-
// courierId: String,
|
|
129
|
-
// courierName: String,
|
|
130
|
-
// deliveryCharges: Number,
|
|
131
|
-
// estimatedDays: Number,
|
|
132
|
-
// deliveryDate: String
|
|
133
|
-
// },
|
|
134
|
-
// cancellationAttemptedAt: Date,
|
|
135
|
-
// cancellationResult: {
|
|
136
|
-
// success: Boolean,
|
|
137
|
-
// message: String,
|
|
138
|
-
// error: String,
|
|
139
|
-
// responseData: mongoose.Schema.Types.Mixed
|
|
140
|
-
// },
|
|
141
|
-
// cancellationEligibility: {
|
|
142
|
-
// eligible: Boolean,
|
|
143
|
-
// reason: String
|
|
144
|
-
// }
|
|
145
|
-
// },
|
|
146
|
-
// packageDetails: {
|
|
147
|
-
// totalWeight: Number,
|
|
148
|
-
// weightUnit: {
|
|
149
|
-
// type: String,
|
|
150
|
-
// default: 'grams'
|
|
151
|
-
// },
|
|
152
|
-
// dimensions: {
|
|
153
|
-
// length: Number,
|
|
154
|
-
// width: Number,
|
|
155
|
-
// height: Number
|
|
156
|
-
// },
|
|
157
|
-
// volumetricWeight: Number
|
|
158
|
-
// },
|
|
159
|
-
// pickupAddresses: [{
|
|
160
|
-
// sellerUserId: {
|
|
161
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
162
|
-
// ref: 'users',
|
|
163
|
-
// required: true
|
|
164
|
-
// },
|
|
165
|
-
// name: String,
|
|
166
|
-
// mobile: String,
|
|
167
|
-
// addressLine1: {
|
|
168
|
-
// type: String,
|
|
169
|
-
// trim: true,
|
|
170
|
-
// maxLength: 150,
|
|
171
|
-
// },
|
|
172
|
-
// addressLine2: {
|
|
173
|
-
// type: String,
|
|
174
|
-
// trim: true,
|
|
175
|
-
// maxLength: 150,
|
|
176
|
-
// },
|
|
177
|
-
// city: {
|
|
178
|
-
// type: String,
|
|
179
|
-
// trim: true,
|
|
180
|
-
// maxLength: 50,
|
|
181
|
-
// },
|
|
182
|
-
// state: {
|
|
183
|
-
// type: String,
|
|
184
|
-
// trim: true,
|
|
185
|
-
// maxLength: 50,
|
|
186
|
-
// },
|
|
187
|
-
// pincode: {
|
|
188
|
-
// type: String,
|
|
189
|
-
// trim: true,
|
|
190
|
-
// maxLength: 6,
|
|
191
|
-
// },
|
|
192
|
-
// }],
|
|
193
|
-
// paymentMethod: {
|
|
194
|
-
// type: String,
|
|
195
|
-
// enum: ['CARD', 'UPI', 'NETBANKING', 'WALLET', 'COD', "PENDING_PAYMENT", "CASHFREE","RAZORPAY", "Online"],
|
|
196
|
-
// required: true
|
|
197
|
-
// },
|
|
198
|
-
// paymentStatus: {
|
|
199
|
-
// type: String,
|
|
200
|
-
// enum: ['PENDING', 'PAID', 'FAILED', 'REFUNDED'],
|
|
201
|
-
// default: 'PENDING',
|
|
202
|
-
// required: true
|
|
203
|
-
// },
|
|
204
|
-
// orderStatus: {
|
|
205
|
-
// type: String,
|
|
206
|
-
// enum: [
|
|
207
|
-
// 'PENDING_PAYMENT',
|
|
208
|
-
// 'ORDERED',
|
|
209
|
-
// 'PACKED',
|
|
210
|
-
// 'SHIPPED',
|
|
211
|
-
// 'OUT_FOR_DELIVERY',
|
|
212
|
-
// 'DELIVERED',
|
|
213
|
-
// 'CANCELLED',
|
|
214
|
-
// 'RETURN_REQUESTED',
|
|
215
|
-
// 'RETURN_APPROVED',
|
|
216
|
-
// 'RETURN_SHIPPED',
|
|
217
|
-
// 'RETURN_RECEIVED',
|
|
218
|
-
// 'REFUNDED',
|
|
219
|
-
// 'REPLACEMENT_SHIPPED',
|
|
220
|
-
// 'REPLACEMENT_DELIVERED'
|
|
221
|
-
// ],
|
|
222
|
-
// // default: 'ORDERED', // Default should be the initial state
|
|
223
|
-
// required: true
|
|
224
|
-
// },
|
|
225
|
-
// sourceType: {
|
|
226
|
-
// type: String,
|
|
227
|
-
// enum: ['static', 'shoppable_video', 'livestream', 'auction'],
|
|
228
|
-
// required: true
|
|
229
|
-
// },
|
|
230
|
-
// sourceRefId: String,
|
|
231
|
-
// deliveryCharge: {
|
|
232
|
-
// type: Number,
|
|
233
|
-
// default: 40
|
|
234
|
-
// },
|
|
235
|
-
// statusTimeline: {
|
|
236
|
-
// ordered: Date,
|
|
237
|
-
// paid: Date,
|
|
238
|
-
// packed: Date,
|
|
239
|
-
// shipped: Date,
|
|
240
|
-
// outForDelivery: Date,
|
|
241
|
-
// delivered: Date,
|
|
242
|
-
// cancelled: Date,
|
|
243
|
-
// returnRequested: Date,
|
|
244
|
-
// returnApproved: Date,
|
|
245
|
-
// returnShipped: Date,
|
|
246
|
-
// returnReceived: Date,
|
|
247
|
-
// refunded: Date,
|
|
248
|
-
// replacementShipped: Date,
|
|
249
|
-
// replacementDelivered: Date
|
|
250
|
-
// },
|
|
251
|
-
// courierDetails: {
|
|
252
|
-
// carrier: String,
|
|
253
|
-
// trackingNumber: String,
|
|
254
|
-
// estimatedDelivery: Date
|
|
255
|
-
// },
|
|
256
|
-
// returnDetails: {
|
|
257
|
-
// reason: String,
|
|
258
|
-
// type: {
|
|
259
|
-
// type: String,
|
|
260
|
-
// enum: ['REFUND', 'REPLACE']
|
|
261
|
-
// },
|
|
262
|
-
// items: [{
|
|
263
|
-
// productId: mongoose.Schema.Types.ObjectId,
|
|
264
|
-
// quantity: Number
|
|
265
|
-
// }]
|
|
266
|
-
// },
|
|
267
|
-
// refundDetails: {
|
|
268
|
-
// amount: Number,
|
|
269
|
-
// method: String,
|
|
270
|
-
// transactionId: String
|
|
271
|
-
// },
|
|
272
|
-
// replacementDetails: {
|
|
273
|
-
// trackingNumber: String,
|
|
274
|
-
// replacementOrderId: mongoose.Schema.Types.ObjectId
|
|
275
|
-
// },
|
|
276
|
-
// returnRequests: [{
|
|
277
|
-
// _id: { type: mongoose.Schema.Types.ObjectId, auto: true },
|
|
278
|
-
// orderItemId: { // Reference to the specific item in the order
|
|
279
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
280
|
-
// required: true
|
|
281
|
-
// },
|
|
282
|
-
// reason: String,
|
|
283
|
-
// additionalNotes: String,
|
|
284
|
-
// images: [String],
|
|
285
|
-
// status: {
|
|
286
|
-
// type: String,
|
|
287
|
-
// enum: ['PENDING',
|
|
288
|
-
// 'APPROVED',
|
|
289
|
-
// 'REJECTED',
|
|
290
|
-
// 'RETURN_SHIPPED',
|
|
291
|
-
// 'RETURN_RECEIVED',
|
|
292
|
-
// 'REFUNDED'],
|
|
293
|
-
// default: 'PENDING'
|
|
294
|
-
// },
|
|
295
|
-
// shipmentDetails: {
|
|
296
|
-
// carrier: String,
|
|
297
|
-
// trackingNumber: String,
|
|
298
|
-
// receiptImage: String, // S3 key for uploaded image
|
|
299
|
-
// shippedAt: Date
|
|
300
|
-
// },
|
|
301
|
-
// receivedAt: Date,
|
|
302
|
-
// refundProcessedAt: Date,
|
|
303
|
-
// sellerResponse: String,
|
|
304
|
-
// requestedAt: Date,
|
|
305
|
-
// processedAt: Date
|
|
306
|
-
// }],
|
|
307
|
-
// cancelReason: String,
|
|
308
|
-
// cancelSource: {
|
|
309
|
-
// type: String,
|
|
310
|
-
// enum: ['user', 'seller', 'system'],
|
|
311
|
-
// default: 'user'
|
|
312
|
-
// },
|
|
313
|
-
// payment: {
|
|
314
|
-
// type: mongoose.Schema.Types.ObjectId,
|
|
315
|
-
// ref: 'orderPayment'
|
|
316
|
-
// },
|
|
317
|
-
// invoiceKey: {
|
|
318
|
-
// type: String,
|
|
319
|
-
// default: null
|
|
320
|
-
// },
|
|
321
|
-
// invoiceStatus: {
|
|
322
|
-
// type: String,
|
|
323
|
-
// enum: ['pending', 'processing', 'completed', 'failed'],
|
|
324
|
-
// default: 'pending'
|
|
325
|
-
// },
|
|
326
|
-
// invoiceRetries: {
|
|
327
|
-
// type: Number,
|
|
328
|
-
// default: 0
|
|
329
|
-
// },
|
|
330
|
-
// invoiceError: String
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
// },
|
|
338
|
-
|
|
339
|
-
// { timestamps: true }
|
|
340
|
-
// );
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// const Order = mongoose.model('Order', orderSchema);
|
|
344
|
-
// export default Order;
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
// const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
|
|
348
|
-
// export default Order;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
1
|
|
|
354
2
|
// order.modal.js
|
|
355
3
|
import mongoose from 'mongoose';
|
|
@@ -600,7 +248,7 @@ const orderSchema = new mongoose.Schema(
|
|
|
600
248
|
},
|
|
601
249
|
sourceType: {
|
|
602
250
|
type: String,
|
|
603
|
-
enum: ['static', 'shoppable_video', 'livestream', 'auction','flash_sale'],
|
|
251
|
+
enum: ['static', 'shoppable_video', 'livestream', 'auction', 'flash_sale', 'giveaway'],
|
|
604
252
|
required: true
|
|
605
253
|
},
|
|
606
254
|
sourceRefId: String,
|
|
@@ -54,7 +54,21 @@ const ProductListingSchema = new Schema(
|
|
|
54
54
|
min: 0,
|
|
55
55
|
default: null,
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
logisticsType: {
|
|
58
|
+
type: String,
|
|
59
|
+
enum: ["flykupLogistics", "selfShipment"],
|
|
60
|
+
default: null,
|
|
61
|
+
},
|
|
62
|
+
deliveryCharge: {
|
|
63
|
+
type: Number,
|
|
64
|
+
min: 0,
|
|
65
|
+
default: null,
|
|
66
|
+
},
|
|
67
|
+
estimatedDeliveryDate: {
|
|
68
|
+
type: Date,
|
|
69
|
+
default: null,
|
|
70
|
+
},
|
|
71
|
+
|
|
58
72
|
// --- ADDED/UPDATED FIELDS FROM FRONTEND ---
|
|
59
73
|
brand: { type: String, default: null }, // ADDED
|
|
60
74
|
manufacturer: String,
|
package/models/stock.model.js
CHANGED
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
// import mongoose from "mongoose";
|
|
2
|
-
// const { Schema, model } = mongoose;
|
|
3
|
-
|
|
4
|
-
// const StockSchema = new Schema(
|
|
5
|
-
// {
|
|
6
|
-
// sellerId: {
|
|
7
|
-
// type: Schema.Types.ObjectId,
|
|
8
|
-
// ref: "sellers",
|
|
9
|
-
// },
|
|
10
|
-
// productListingId: {
|
|
11
|
-
// type: Schema.Types.ObjectId,
|
|
12
|
-
// ref: "productlistings",
|
|
13
|
-
// },
|
|
14
|
-
// title: String,
|
|
15
|
-
// quantity: {
|
|
16
|
-
// type: Number,
|
|
17
|
-
// min: 0,
|
|
18
|
-
// default: null,
|
|
19
|
-
// },
|
|
20
|
-
// images: [
|
|
21
|
-
// {
|
|
22
|
-
// key: { type: String, maxLength: 255, default: null },
|
|
23
|
-
// blobName: { type: String, maxLength: 255, default: null },
|
|
24
|
-
// azureUrl: { type: String, maxLength: 1024, default: null },
|
|
25
|
-
// },
|
|
26
|
-
// ],
|
|
27
|
-
// mfgDate: {
|
|
28
|
-
// type: String,
|
|
29
|
-
// default: null,
|
|
30
|
-
// },
|
|
31
|
-
// expDate: {
|
|
32
|
-
// type: String,
|
|
33
|
-
// default: null,
|
|
34
|
-
// },
|
|
35
|
-
// },
|
|
36
|
-
// { timestamps: true }
|
|
37
|
-
// );
|
|
38
|
-
|
|
39
|
-
// const Stock = mongoose.models.stocks || mongoose.model("stocks", StockSchema);
|
|
40
|
-
// export default Stock;
|
|
41
1
|
|
|
42
2
|
// models/Stock.js
|
|
43
3
|
import mongoose from "mongoose";
|