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