flykup_model_production 1.0.15 → 1.0.17
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/.gitattributes +2 -0
- package/.github/workflows/publish.yml +31 -0
- package/auth.js +14 -14
- package/config.js +1 -1
- package/db_connection.js +23 -23
- package/index.js +140 -140
- package/models/AadhaarVerification.js +131 -131
- package/models/AdminEmail.model.js +38 -38
- package/models/BankVerification.js +92 -92
- package/models/GSTVerification.js +89 -89
- package/models/LiveStreamInteraction.model.js +101 -101
- package/models/ProductInteraction.model.js +108 -108
- package/models/Review.model.js +121 -121
- package/models/SearchAnalytics.js +23 -23
- package/models/ShoppableInteraction.model.js +106 -106
- package/models/Wishlist.model.js +29 -29
- package/models/admin.model.js +42 -42
- package/models/appUpdate.model.js +19 -19
- package/models/assets.model.js +32 -32
- package/models/blockedRegion.models.js +27 -27
- package/models/chat.model.js +511 -511
- package/models/coHostInvitation.model.js +60 -60
- package/models/follow.model.js +38 -38
- package/models/loginlogs.model.js +26 -26
- package/models/notification.model.js +130 -129
- package/models/order.modal.js +385 -381
- package/models/orderPayment.model.js +219 -105
- package/models/productListing.model.js +322 -318
- package/models/profileInteractions.model.js +44 -44
- package/models/registerShow.model.js +29 -29
- package/models/sellerDraft.model.js +27 -27
- package/models/seller_settlements_2025-11-18 (1).csv +4 -0
- package/models/seller_settlements_2025-11-18.csv +4 -0
- package/models/shipper.model.js +126 -126
- package/models/shoppableVideo.model.js +237 -237
- package/models/shoppableVideoComment.model.js +57 -57
- package/models/shoppableVideoLike.model.js +29 -29
- package/models/shoppableVideoSave.model.js +27 -27
- package/models/shows.model.js +603 -570
- package/models/stock.model.js +105 -105
- package/models/ticket.model.js +115 -115
- package/models/user.model.js +7 -0
- package/package.json +18 -18
|
@@ -1,318 +1,322 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
const { Schema } = mongoose;
|
|
3
|
-
|
|
4
|
-
const ProductListingSchema = new Schema(
|
|
5
|
-
{
|
|
6
|
-
sellerId: { type: Schema.Types.ObjectId, ref: "sellers" },
|
|
7
|
-
stockId: { type: Schema.Types.ObjectId, ref: "stocks" }, // ✅ KEEP THIS - for main inventory management
|
|
8
|
-
title: String,
|
|
9
|
-
description: String,
|
|
10
|
-
flashSale: {
|
|
11
|
-
isActive: { type: Boolean, default: false },
|
|
12
|
-
flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
|
|
13
|
-
flashPrice: { type: Number, default: 0 },
|
|
14
|
-
// ❌ REMOVED: flashStock field - now using main quantity
|
|
15
|
-
originalPrice: { type: Number, default: 0 },
|
|
16
|
-
endsAt: { type: Date, default: null },
|
|
17
|
-
startsAt: { type: Date, default: null }
|
|
18
|
-
},
|
|
19
|
-
reserveForLive: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: false
|
|
22
|
-
},
|
|
23
|
-
sku: {
|
|
24
|
-
type: String,
|
|
25
|
-
required: true,
|
|
26
|
-
index: true
|
|
27
|
-
},
|
|
28
|
-
images: [
|
|
29
|
-
{
|
|
30
|
-
key: { type: String, maxLength: 255, default: null },
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
category: String,
|
|
34
|
-
subcategory: String,
|
|
35
|
-
hsnNo: String,
|
|
36
|
-
MRP: {
|
|
37
|
-
type: Number,
|
|
38
|
-
min: 0,
|
|
39
|
-
default: null,
|
|
40
|
-
},
|
|
41
|
-
productPrice: {
|
|
42
|
-
type: Number,
|
|
43
|
-
min: 0,
|
|
44
|
-
default: null,
|
|
45
|
-
},
|
|
46
|
-
startingPrice: {
|
|
47
|
-
type: Number,
|
|
48
|
-
min: 0,
|
|
49
|
-
default: null,
|
|
50
|
-
},
|
|
51
|
-
reservedPrice: {
|
|
52
|
-
type: Number,
|
|
53
|
-
min: 0,
|
|
54
|
-
default: null,
|
|
55
|
-
},
|
|
56
|
-
logisticsType: {
|
|
57
|
-
type: String,
|
|
58
|
-
enum: ["flykupLogistics", "selfShipment"],
|
|
59
|
-
default: null,
|
|
60
|
-
},
|
|
61
|
-
deliveryCharge: {
|
|
62
|
-
type: Number,
|
|
63
|
-
min: 0,
|
|
64
|
-
default: null,
|
|
65
|
-
},
|
|
66
|
-
estimatedDeliveryDate: {
|
|
67
|
-
type: Number,
|
|
68
|
-
min: 0,
|
|
69
|
-
default: null,
|
|
70
|
-
},
|
|
71
|
-
brand: { type: String, default: null },
|
|
72
|
-
manufacturer: String,
|
|
73
|
-
manufacturerAddress: String,
|
|
74
|
-
countryOfOrigin: String,
|
|
75
|
-
netQuantity: { type: String, default: null },
|
|
76
|
-
packagingType: { type: String, default: null },
|
|
77
|
-
weight: {
|
|
78
|
-
value: { type: Number, default: null },
|
|
79
|
-
unit: { type: String, default: null },
|
|
80
|
-
},
|
|
81
|
-
dimensions: {
|
|
82
|
-
length: { type: Number, default: null },
|
|
83
|
-
width: { type: Number, default: null },
|
|
84
|
-
height: { type: Number, default: null },
|
|
85
|
-
},
|
|
86
|
-
expiryDate: { type: Date, default: null },
|
|
87
|
-
shelfLife: { type: String, default: null },
|
|
88
|
-
batchNumber: { type: String, default: null },
|
|
89
|
-
gstRate: { type: Number, default: null },
|
|
90
|
-
sellerName: String,
|
|
91
|
-
sellerContact: { type: String, default: null },
|
|
92
|
-
sellerGSTIN: { type: String, default: null },
|
|
93
|
-
returnPolicy: [String],
|
|
94
|
-
warranty: {
|
|
95
|
-
hasWarranty: { type: Boolean, default: false },
|
|
96
|
-
duration: { type: String, default: null },
|
|
97
|
-
},
|
|
98
|
-
fssaiLicenseNo: { type: String, default: null },
|
|
99
|
-
bisCertification: { type: String, default: null },
|
|
100
|
-
importerName: { type: String, default: null },
|
|
101
|
-
importerAddress: { type: String, default: null },
|
|
102
|
-
importerGSTIN: { type: String, default: null },
|
|
103
|
-
eWasteCompliance: { type: Boolean, default: false },
|
|
104
|
-
recyclablePackaging: { type: Boolean, default: false },
|
|
105
|
-
hazardousMaterials: { type: String, default: null },
|
|
106
|
-
allowDropshipping: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
default: false,
|
|
109
|
-
index: true,
|
|
110
|
-
},
|
|
111
|
-
commissionRate: {
|
|
112
|
-
type: Number,
|
|
113
|
-
min: [0, 'Commission rate cannot be negative.'],
|
|
114
|
-
max: [100, 'Commission rate cannot exceed 100%.'],
|
|
115
|
-
default: null,
|
|
116
|
-
},
|
|
117
|
-
hasReturn: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
default: false
|
|
120
|
-
},
|
|
121
|
-
returnDays: {
|
|
122
|
-
type: Number,
|
|
123
|
-
min: 0,
|
|
124
|
-
default: null
|
|
125
|
-
},
|
|
126
|
-
size: {
|
|
127
|
-
type: String,
|
|
128
|
-
default: null
|
|
129
|
-
},
|
|
130
|
-
isActive: {
|
|
131
|
-
type: Boolean,
|
|
132
|
-
default: true,
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
//
|
|
228
|
-
//
|
|
229
|
-
//
|
|
230
|
-
//
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
// },
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
//
|
|
258
|
-
//
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
// //
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
// //
|
|
275
|
-
// //
|
|
276
|
-
// //
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
// type:
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
// default: null
|
|
290
|
-
// },
|
|
291
|
-
//
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
// },
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
//
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
const { Schema } = mongoose;
|
|
3
|
+
|
|
4
|
+
const ProductListingSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
sellerId: { type: Schema.Types.ObjectId, ref: "sellers" },
|
|
7
|
+
stockId: { type: Schema.Types.ObjectId, ref: "stocks" }, // ✅ KEEP THIS - for main inventory management
|
|
8
|
+
title: String,
|
|
9
|
+
description: String,
|
|
10
|
+
flashSale: {
|
|
11
|
+
isActive: { type: Boolean, default: false },
|
|
12
|
+
flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
|
|
13
|
+
flashPrice: { type: Number, default: 0 },
|
|
14
|
+
// ❌ REMOVED: flashStock field - now using main quantity
|
|
15
|
+
originalPrice: { type: Number, default: 0 },
|
|
16
|
+
endsAt: { type: Date, default: null },
|
|
17
|
+
startsAt: { type: Date, default: null }
|
|
18
|
+
},
|
|
19
|
+
reserveForLive: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
sku: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
index: true
|
|
27
|
+
},
|
|
28
|
+
images: [
|
|
29
|
+
{
|
|
30
|
+
key: { type: String, maxLength: 255, default: null },
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
category: String,
|
|
34
|
+
subcategory: String,
|
|
35
|
+
hsnNo: String,
|
|
36
|
+
MRP: {
|
|
37
|
+
type: Number,
|
|
38
|
+
min: 0,
|
|
39
|
+
default: null,
|
|
40
|
+
},
|
|
41
|
+
productPrice: {
|
|
42
|
+
type: Number,
|
|
43
|
+
min: 0,
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
46
|
+
startingPrice: {
|
|
47
|
+
type: Number,
|
|
48
|
+
min: 0,
|
|
49
|
+
default: null,
|
|
50
|
+
},
|
|
51
|
+
reservedPrice: {
|
|
52
|
+
type: Number,
|
|
53
|
+
min: 0,
|
|
54
|
+
default: null,
|
|
55
|
+
},
|
|
56
|
+
logisticsType: {
|
|
57
|
+
type: String,
|
|
58
|
+
enum: ["flykupLogistics", "selfShipment"],
|
|
59
|
+
default: null,
|
|
60
|
+
},
|
|
61
|
+
deliveryCharge: {
|
|
62
|
+
type: Number,
|
|
63
|
+
min: 0,
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
66
|
+
estimatedDeliveryDate: {
|
|
67
|
+
type: Number,
|
|
68
|
+
min: 0,
|
|
69
|
+
default: null,
|
|
70
|
+
},
|
|
71
|
+
brand: { type: String, default: null },
|
|
72
|
+
manufacturer: String,
|
|
73
|
+
manufacturerAddress: String,
|
|
74
|
+
countryOfOrigin: String,
|
|
75
|
+
netQuantity: { type: String, default: null },
|
|
76
|
+
packagingType: { type: String, default: null },
|
|
77
|
+
weight: {
|
|
78
|
+
value: { type: Number, default: null },
|
|
79
|
+
unit: { type: String, default: null },
|
|
80
|
+
},
|
|
81
|
+
dimensions: {
|
|
82
|
+
length: { type: Number, default: null },
|
|
83
|
+
width: { type: Number, default: null },
|
|
84
|
+
height: { type: Number, default: null },
|
|
85
|
+
},
|
|
86
|
+
expiryDate: { type: Date, default: null },
|
|
87
|
+
shelfLife: { type: String, default: null },
|
|
88
|
+
batchNumber: { type: String, default: null },
|
|
89
|
+
gstRate: { type: Number, default: null },
|
|
90
|
+
sellerName: String,
|
|
91
|
+
sellerContact: { type: String, default: null },
|
|
92
|
+
sellerGSTIN: { type: String, default: null },
|
|
93
|
+
returnPolicy: [String],
|
|
94
|
+
warranty: {
|
|
95
|
+
hasWarranty: { type: Boolean, default: false },
|
|
96
|
+
duration: { type: String, default: null },
|
|
97
|
+
},
|
|
98
|
+
fssaiLicenseNo: { type: String, default: null },
|
|
99
|
+
bisCertification: { type: String, default: null },
|
|
100
|
+
importerName: { type: String, default: null },
|
|
101
|
+
importerAddress: { type: String, default: null },
|
|
102
|
+
importerGSTIN: { type: String, default: null },
|
|
103
|
+
eWasteCompliance: { type: Boolean, default: false },
|
|
104
|
+
recyclablePackaging: { type: Boolean, default: false },
|
|
105
|
+
hazardousMaterials: { type: String, default: null },
|
|
106
|
+
allowDropshipping: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
index: true,
|
|
110
|
+
},
|
|
111
|
+
commissionRate: {
|
|
112
|
+
type: Number,
|
|
113
|
+
min: [0, 'Commission rate cannot be negative.'],
|
|
114
|
+
max: [100, 'Commission rate cannot exceed 100%.'],
|
|
115
|
+
default: null,
|
|
116
|
+
},
|
|
117
|
+
hasReturn: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
returnDays: {
|
|
122
|
+
type: Number,
|
|
123
|
+
min: 0,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
size: {
|
|
127
|
+
type: String,
|
|
128
|
+
default: null
|
|
129
|
+
},
|
|
130
|
+
isActive: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: true,
|
|
133
|
+
},
|
|
134
|
+
shopifySynced: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
ratingSummary: {
|
|
139
|
+
averageRating: { type: Number, default: 0 },
|
|
140
|
+
totalRatings: { type: Number, default: 0 },
|
|
141
|
+
ratingDistribution: {
|
|
142
|
+
1: { type: Number, default: 0 },
|
|
143
|
+
2: { type: Number, default: 0 },
|
|
144
|
+
3: { type: Number, default: 0 },
|
|
145
|
+
4: { type: Number, default: 0 },
|
|
146
|
+
5: { type: Number, default: 0 }
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
totalReviews: { type: Number, default: 0 }
|
|
150
|
+
},
|
|
151
|
+
{ timestamps: true }
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
ProductListingSchema.index({ title: 'text', description: 'text', category: 'text' });
|
|
155
|
+
|
|
156
|
+
const ProductListing = mongoose.models.productlistings || mongoose.model("productlistings", ProductListingSchema);
|
|
157
|
+
export default ProductListing;
|
|
158
|
+
|
|
159
|
+
// // backend/models/ProductListing.js (or similar path)
|
|
160
|
+
// import mongoose from "mongoose";
|
|
161
|
+
// const { Schema } = mongoose;
|
|
162
|
+
|
|
163
|
+
// const ProductListingSchema = new Schema(
|
|
164
|
+
// {
|
|
165
|
+
// sellerId: { type: Schema.Types.ObjectId, ref: "sellers" },
|
|
166
|
+
// stockId: { type: Schema.Types.ObjectId, ref: "stocks" },
|
|
167
|
+
// title: String,
|
|
168
|
+
// description: String,
|
|
169
|
+
// flashSale: {
|
|
170
|
+
// isActive: { type: Boolean, default: false },
|
|
171
|
+
// flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
|
|
172
|
+
// flashPrice: { type: Number, default: 0 },
|
|
173
|
+
// flashStock: { type: Number, default: 0 },
|
|
174
|
+
// originalPrice: { type: Number, default: 0 },
|
|
175
|
+
// endsAt: { type: Date, default: null },
|
|
176
|
+
// startsAt: { type: Date, default: null }
|
|
177
|
+
// },
|
|
178
|
+
// sku: {
|
|
179
|
+
// type: String,
|
|
180
|
+
// required: true,
|
|
181
|
+
// index: true
|
|
182
|
+
// },
|
|
183
|
+
// images: [
|
|
184
|
+
// {
|
|
185
|
+
// key: { type: String, maxLength: 255, default: null },
|
|
186
|
+
// }
|
|
187
|
+
// ],
|
|
188
|
+
// category: String,
|
|
189
|
+
// subcategory: String,
|
|
190
|
+
// hsnNo: String,
|
|
191
|
+
// MRP: {
|
|
192
|
+
// type: Number,
|
|
193
|
+
// min: 0,
|
|
194
|
+
// default: null,
|
|
195
|
+
// },
|
|
196
|
+
// productPrice: {
|
|
197
|
+
// type: Number,
|
|
198
|
+
// min: 0,
|
|
199
|
+
// default: null,
|
|
200
|
+
// },
|
|
201
|
+
// startingPrice: {
|
|
202
|
+
// type: Number,
|
|
203
|
+
// min: 0,
|
|
204
|
+
// default: null,
|
|
205
|
+
// },
|
|
206
|
+
// reservedPrice: {
|
|
207
|
+
// type: Number,
|
|
208
|
+
// min: 0,
|
|
209
|
+
// default: null,
|
|
210
|
+
// },
|
|
211
|
+
// logisticsType: {
|
|
212
|
+
// type: String,
|
|
213
|
+
// enum: ["flykupLogistics", "selfShipment"],
|
|
214
|
+
// default: null,
|
|
215
|
+
// },
|
|
216
|
+
// deliveryCharge: {
|
|
217
|
+
// type: Number,
|
|
218
|
+
// min: 0,
|
|
219
|
+
// default: null,
|
|
220
|
+
// },
|
|
221
|
+
// estimatedDeliveryDate: {
|
|
222
|
+
// type: Number, // Change from Date to Number
|
|
223
|
+
// min: 0,
|
|
224
|
+
// default: null,
|
|
225
|
+
// },
|
|
226
|
+
|
|
227
|
+
// // --- ADDED/UPDATED FIELDS FROM FRONTEND ---
|
|
228
|
+
// brand: { type: String, default: null }, // ADDED
|
|
229
|
+
// manufacturer: String,
|
|
230
|
+
// manufacturerAddress: String, // ADDED in frontend, already exists here
|
|
231
|
+
// countryOfOrigin: String,
|
|
232
|
+
// netQuantity: { type: String, default: null }, // ADDED (String to accommodate units like '500g')
|
|
233
|
+
// packagingType: { type: String, default: null }, // ADDED
|
|
234
|
+
// weight: { // For shipping calculations
|
|
235
|
+
// value: { type: Number, default: null },
|
|
236
|
+
// unit: { type: String, default: null },
|
|
237
|
+
// },
|
|
238
|
+
// dimensions: { // For shipping calculations
|
|
239
|
+
// length: { type: Number, default: null },
|
|
240
|
+
// width: { type: Number, default: null },
|
|
241
|
+
// height: { type: Number, default: null },
|
|
242
|
+
// },
|
|
243
|
+
// expiryDate: { type: Date, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
244
|
+
// shelfLife: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
245
|
+
// batchNumber: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
246
|
+
// gstRate: { type: Number, default: null }, // Changed to allow null if needed
|
|
247
|
+
// sellerName: String,
|
|
248
|
+
// sellerContact: { type: String, default: null }, // ADDED
|
|
249
|
+
// sellerGSTIN: { type: String, default: null }, // ADDED
|
|
250
|
+
// returnPolicy: [String],
|
|
251
|
+
// warranty: {
|
|
252
|
+
// hasWarranty: { type: Boolean, default: false }, // Default added
|
|
253
|
+
// duration: { type: String, default: null }, // Default added
|
|
254
|
+
// },
|
|
255
|
+
// fssaiLicenseNo: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
256
|
+
// bisCertification: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
257
|
+
// importerName: { type: String, default: null }, // Default added
|
|
258
|
+
// importerAddress: { type: String, default: null }, // Default added
|
|
259
|
+
// importerGSTIN: { type: String, default: null }, // Default added
|
|
260
|
+
// eWasteCompliance: { type: Boolean, default: false }, // Default added
|
|
261
|
+
// recyclablePackaging: { type: Boolean, default: false }, // Default added
|
|
262
|
+
// hazardousMaterials: { type: String, default: null }, // Default added
|
|
263
|
+
// allowDropshipping: {
|
|
264
|
+
// type: Boolean,
|
|
265
|
+
// default: false,
|
|
266
|
+
// index: true,
|
|
267
|
+
// },
|
|
268
|
+
// commissionRate: {
|
|
269
|
+
// type: Number,
|
|
270
|
+
// min: [0, 'Commission rate cannot be negative.'],
|
|
271
|
+
// // max: [100, 'Commission rate cannot exceed 100%.'], // Max was 25, changed to 100 based on frontend
|
|
272
|
+
// max: [100, 'Commission rate cannot exceed 100%.'],
|
|
273
|
+
// default: null,
|
|
274
|
+
// // Removed Mongoose-level required validation dependent on allowDropshipping
|
|
275
|
+
// // Let application logic handle this if needed, or adjust validator
|
|
276
|
+
// // required: [
|
|
277
|
+
// // function () { return this.allowDropshipping === true; },
|
|
278
|
+
// // 'Commission rate is required when allowing dropshipping.'
|
|
279
|
+
// // ],
|
|
280
|
+
// // validate: { ... } // Keep or remove validation as needed
|
|
281
|
+
// },
|
|
282
|
+
// hasReturn: {
|
|
283
|
+
// type: Boolean,
|
|
284
|
+
// default: false
|
|
285
|
+
// },
|
|
286
|
+
// returnDays: {
|
|
287
|
+
// type: Number,
|
|
288
|
+
// min: 0,
|
|
289
|
+
// default: null
|
|
290
|
+
// },
|
|
291
|
+
// size: {
|
|
292
|
+
// type: String,
|
|
293
|
+
// default: null
|
|
294
|
+
// },
|
|
295
|
+
// isActive: {
|
|
296
|
+
// type: Boolean,
|
|
297
|
+
// default: true,
|
|
298
|
+
// },ratingSummary: {
|
|
299
|
+
// averageRating: { type: Number, default: 0 },
|
|
300
|
+
// totalRatings: { type: Number, default: 0 },
|
|
301
|
+
// ratingDistribution: {
|
|
302
|
+
// 1: { type: Number, default: 0 },
|
|
303
|
+
// 2: { type: Number, default: 0 },
|
|
304
|
+
// 3: { type: Number, default: 0 },
|
|
305
|
+
// 4: { type: Number, default: 0 },
|
|
306
|
+
// 5: { type: Number, default: 0 }
|
|
307
|
+
// }
|
|
308
|
+
// },
|
|
309
|
+
// totalReviews: { type: Number, default: 0 }
|
|
310
|
+
// },
|
|
311
|
+
// { timestamps: true }
|
|
312
|
+
// );
|
|
313
|
+
// ProductListingSchema.index({ title: 'text', description: 'text', category: 'text' });
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
// // Safe export to prevent OverwriteModelError
|
|
317
|
+
// const ProductListing = mongoose.models.productlistings || mongoose.model("productlistings", ProductListingSchema);
|
|
318
|
+
// export default ProductListing;
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|