flykup_model_development 3.1.26 → 3.1.28

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.
@@ -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,
@@ -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';
@@ -361,7 +9,7 @@ const orderSchema = new mongoose.Schema(
361
9
  type: String,
362
10
  required: true,
363
11
  unique: true,
364
- default: () => `ORD-${nanoid(8)}`
12
+ default: () => `FLY-ORD-${nanoid(8)}`
365
13
  },
366
14
  userId: {
367
15
  type: mongoose.Schema.Types.ObjectId,
@@ -156,172 +156,3 @@ export default ProductListing;
156
156
 
157
157
 
158
158
 
159
-
160
-
161
- // // backend/models/ProductListing.js (or similar path)
162
- // import mongoose from "mongoose";
163
- // const { Schema } = mongoose;
164
-
165
- // const ProductListingSchema = new Schema(
166
- // {
167
- // sellerId: { type: Schema.Types.ObjectId, ref: "sellers" },
168
- // stockId: { type: Schema.Types.ObjectId, ref: "stocks" },
169
- // title: String,
170
- // description: String,
171
- // flashSale: {
172
- // isActive: { type: Boolean, default: false },
173
- // flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
174
- // flashPrice: { type: Number, default: 0 },
175
- // flashStock: { type: Number, default: 0 },
176
- // originalPrice: { type: Number, default: 0 },
177
- // endsAt: { type: Date, default: null },
178
- // startsAt: { type: Date, default: null }
179
- // },
180
-
181
- // //new fields added
182
-
183
- // returnPolicy: {
184
- // hasReturn: { type: Boolean, default: false },
185
- // returnType: {
186
- // type: [String],
187
- // enum: ['refund', 'replacement'],
188
- // default: []
189
- // },
190
- // returnDays: { type: Number, min: 0, default: null },
191
- // terms: [String] // Keep existing terms for backward compatibility
192
- // },
193
- // sku: {
194
- // type: String,
195
- // required: true,
196
- // match: [/^[A-Za-z0-9-]{6,}$/, 'SKU must be at least 6 alphanumeric characters']
197
- // },
198
- // // ----------end of new fields added
199
- // images: [
200
- // {
201
- // key: { type: String, maxLength: 255, default: null },
202
- // }
203
- // ],
204
- // category: String,
205
- // subcategory: String,
206
- // hsnNo: String,
207
- // MRP: {
208
- // type: Number,
209
- // min: 0,
210
- // default: null,
211
- // },
212
- // productPrice: {
213
- // type: Number,
214
- // min: 0,
215
- // default: null,
216
- // },
217
- // startingPrice: {
218
- // type: Number,
219
- // min: 0,
220
- // default: null,
221
- // },
222
- // reservedPrice: {
223
- // type: Number,
224
- // min: 0,
225
- // default: null,
226
- // },
227
-
228
- // // --- ADDED/UPDATED FIELDS FROM FRONTEND ---
229
- // brand: { type: String, default: null }, // ADDED
230
- // manufacturer: String,
231
- // manufacturerAddress: String, // ADDED in frontend, already exists here
232
- // countryOfOrigin: String,
233
- // netQuantity: { type: String, default: null }, // ADDED (String to accommodate units like '500g')
234
- // packagingType: { type: String, default: null }, // ADDED
235
- // weight: { // For shipping calculations
236
- // value: { type: Number, default: null },
237
- // unit: { type: String, default: null },
238
- // },
239
- // dimensions: { // For shipping calculations
240
- // length: { type: Number, default: null },
241
- // width: { type: Number, default: null },
242
- // height: { type: Number, default: null },
243
- // },
244
- // expiryDate: { type: Date, default: null }, // ADDED in frontend, already exists here (changed to allow null)
245
- // shelfLife: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
246
- // batchNumber: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
247
- // gstRate: { type: Number, default: null }, // Changed to allow null if needed
248
- // sellerName: String,
249
- // sellerContact: { type: String, default: null }, // ADDED
250
- // sellerGSTIN: { type: String, default: null }, // ADDED
251
- // returnPolicy: [String],
252
- // warranty: {
253
- // hasWarranty: { type: Boolean, default: false }, // Default added
254
- // duration: { type: String, default: null }, // Default added
255
- // },
256
- // fssaiLicenseNo: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
257
- // bisCertification: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
258
- // importerName: { type: String, default: null }, // Default added
259
- // importerAddress: { type: String, default: null }, // Default added
260
- // importerGSTIN: { type: String, default: null }, // Default added
261
- // eWasteCompliance: { type: Boolean, default: false }, // Default added
262
- // recyclablePackaging: { type: Boolean, default: false }, // Default added
263
- // hazardousMaterials: { type: String, default: null }, // Default added
264
- // allowDropshipping: {
265
- // type: Boolean,
266
- // default: false,
267
- // index: true,
268
- // },
269
- // commissionRate: {
270
- // type: Number,
271
- // min: [0, 'Commission rate cannot be negative.'],
272
- // // max: [100, 'Commission rate cannot exceed 100%.'], // Max was 25, changed to 100 based on frontend
273
- // max: [100, 'Commission rate cannot exceed 100%.'],
274
- // default: null,
275
- // // Removed Mongoose-level required validation dependent on allowDropshipping
276
- // // Let application logic handle this if needed, or adjust validator
277
- // // required: [
278
- // // function () { return this.allowDropshipping === true; },
279
- // // 'Commission rate is required when allowing dropshipping.'
280
- // // ],
281
- // // validate: { ... } // Keep or remove validation as needed
282
- // },
283
- // hasReturn: {
284
- // type: Boolean,
285
- // default: false
286
- // },
287
- // returnDays: {
288
- // type: Number,
289
- // min: 0,
290
- // default: null
291
- // },
292
- // size: {
293
- // type: String,
294
- // default: null
295
- // },
296
- // isActive: {
297
- // type: Boolean,
298
- // default: true,
299
- // },ratingSummary: {
300
- // averageRating: { type: Number, default: 0 },
301
- // totalRatings: { type: Number, default: 0 },
302
- // ratingDistribution: {
303
- // 1: { type: Number, default: 0 },
304
- // 2: { type: Number, default: 0 },
305
- // 3: { type: Number, default: 0 },
306
- // 4: { type: Number, default: 0 },
307
- // 5: { type: Number, default: 0 }
308
- // }
309
- // },
310
- // totalReviews: { type: Number, default: 0 }
311
- // },
312
-
313
-
314
-
315
- // { timestamps: true }
316
- // );
317
- // ProductListingSchema.index({ title: 'text', description: 'text', category: 'text' });
318
- // ProductListingSchema.index({ sellerId: 1, sku: 1 }, { unique: true });
319
-
320
- // // Safe export to prevent OverwriteModelError
321
- // const ProductListing = mongoose.models.productlistings || mongoose.model("productlistings", ProductListingSchema);
322
- // export default ProductListing;
323
-
324
-
325
-
326
-
327
-
@@ -37,8 +37,8 @@ const ShoppableVideoSchema = new Schema(
37
37
  required: false,
38
38
  trim: true,
39
39
  },
40
- category: { type: String, required: true, trim: false},
41
- subcategory: { type: String, required: true, trim: false },
40
+ category: { type: String, required: false, trim: false},
41
+ subcategory: { type: String, required: false, trim: false },
42
42
  // thumbnailURL might be set initially or updated by the processing service
43
43
  isThumbnailEnabled: {
44
44
  type: Boolean,
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "3.1.26",
3
+ "version": "3.1.28",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,