flykup_model_development 3.1.11 → 3.1.13
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/productListing.model.js +184 -0
- package/package.json +1 -1
- package/test.html +12 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
1
5
|
// backend/models/ProductListing.js (or similar path)
|
|
2
6
|
import mongoose from "mongoose";
|
|
3
7
|
const { Schema } = mongoose;
|
|
@@ -133,7 +137,187 @@ totalReviews: { type: Number, default: 0 }
|
|
|
133
137
|
},
|
|
134
138
|
{ timestamps: true }
|
|
135
139
|
);
|
|
140
|
+
ProductListingSchema.index({ title: 'text', description: 'text', category: 'text' });
|
|
141
|
+
|
|
136
142
|
|
|
137
143
|
// Safe export to prevent OverwriteModelError
|
|
138
144
|
const ProductListing = mongoose.models.productlistings || mongoose.model("productlistings", ProductListingSchema);
|
|
139
145
|
export default ProductListing;
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
// // backend/models/ProductListing.js (or similar path)
|
|
158
|
+
// import mongoose from "mongoose";
|
|
159
|
+
// const { Schema } = mongoose;
|
|
160
|
+
|
|
161
|
+
// const ProductListingSchema = new Schema(
|
|
162
|
+
// {
|
|
163
|
+
// sellerId: { type: Schema.Types.ObjectId, ref: "sellers" },
|
|
164
|
+
// stockId: { type: Schema.Types.ObjectId, ref: "stocks" },
|
|
165
|
+
// title: String,
|
|
166
|
+
// description: String,
|
|
167
|
+
// flashSale: {
|
|
168
|
+
// isActive: { type: Boolean, default: false },
|
|
169
|
+
// flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
|
|
170
|
+
// flashPrice: { type: Number, default: 0 },
|
|
171
|
+
// flashStock: { type: Number, default: 0 },
|
|
172
|
+
// originalPrice: { type: Number, default: 0 },
|
|
173
|
+
// endsAt: { type: Date, default: null },
|
|
174
|
+
// startsAt: { type: Date, default: null }
|
|
175
|
+
// },
|
|
176
|
+
|
|
177
|
+
// //new fields added
|
|
178
|
+
|
|
179
|
+
// returnPolicy: {
|
|
180
|
+
// hasReturn: { type: Boolean, default: false },
|
|
181
|
+
// returnType: {
|
|
182
|
+
// type: [String],
|
|
183
|
+
// enum: ['refund', 'replacement'],
|
|
184
|
+
// default: []
|
|
185
|
+
// },
|
|
186
|
+
// returnDays: { type: Number, min: 0, default: null },
|
|
187
|
+
// terms: [String] // Keep existing terms for backward compatibility
|
|
188
|
+
// },
|
|
189
|
+
// sku: {
|
|
190
|
+
// type: String,
|
|
191
|
+
// required: true,
|
|
192
|
+
// match: [/^[A-Za-z0-9-]{6,}$/, 'SKU must be at least 6 alphanumeric characters']
|
|
193
|
+
// },
|
|
194
|
+
// // ----------end of new fields added
|
|
195
|
+
// images: [
|
|
196
|
+
// {
|
|
197
|
+
// key: { type: String, maxLength: 255, default: null },
|
|
198
|
+
// }
|
|
199
|
+
// ],
|
|
200
|
+
// category: String,
|
|
201
|
+
// subcategory: String,
|
|
202
|
+
// hsnNo: String,
|
|
203
|
+
// MRP: {
|
|
204
|
+
// type: Number,
|
|
205
|
+
// min: 0,
|
|
206
|
+
// default: null,
|
|
207
|
+
// },
|
|
208
|
+
// productPrice: {
|
|
209
|
+
// type: Number,
|
|
210
|
+
// min: 0,
|
|
211
|
+
// default: null,
|
|
212
|
+
// },
|
|
213
|
+
// startingPrice: {
|
|
214
|
+
// type: Number,
|
|
215
|
+
// min: 0,
|
|
216
|
+
// default: null,
|
|
217
|
+
// },
|
|
218
|
+
// reservedPrice: {
|
|
219
|
+
// type: Number,
|
|
220
|
+
// min: 0,
|
|
221
|
+
// default: null,
|
|
222
|
+
// },
|
|
223
|
+
|
|
224
|
+
// // --- ADDED/UPDATED FIELDS FROM FRONTEND ---
|
|
225
|
+
// brand: { type: String, default: null }, // ADDED
|
|
226
|
+
// manufacturer: String,
|
|
227
|
+
// manufacturerAddress: String, // ADDED in frontend, already exists here
|
|
228
|
+
// countryOfOrigin: String,
|
|
229
|
+
// netQuantity: { type: String, default: null }, // ADDED (String to accommodate units like '500g')
|
|
230
|
+
// packagingType: { type: String, default: null }, // ADDED
|
|
231
|
+
// weight: { // For shipping calculations
|
|
232
|
+
// value: { type: Number, default: null },
|
|
233
|
+
// unit: { type: String, default: null },
|
|
234
|
+
// },
|
|
235
|
+
// dimensions: { // For shipping calculations
|
|
236
|
+
// length: { type: Number, default: null },
|
|
237
|
+
// width: { type: Number, default: null },
|
|
238
|
+
// height: { type: Number, default: null },
|
|
239
|
+
// },
|
|
240
|
+
// expiryDate: { type: Date, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
241
|
+
// shelfLife: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
242
|
+
// batchNumber: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
243
|
+
// gstRate: { type: Number, default: null }, // Changed to allow null if needed
|
|
244
|
+
// sellerName: String,
|
|
245
|
+
// sellerContact: { type: String, default: null }, // ADDED
|
|
246
|
+
// sellerGSTIN: { type: String, default: null }, // ADDED
|
|
247
|
+
// returnPolicy: [String],
|
|
248
|
+
// warranty: {
|
|
249
|
+
// hasWarranty: { type: Boolean, default: false }, // Default added
|
|
250
|
+
// duration: { type: String, default: null }, // Default added
|
|
251
|
+
// },
|
|
252
|
+
// fssaiLicenseNo: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
253
|
+
// bisCertification: { type: String, default: null }, // ADDED in frontend, already exists here (changed to allow null)
|
|
254
|
+
// importerName: { type: String, default: null }, // Default added
|
|
255
|
+
// importerAddress: { type: String, default: null }, // Default added
|
|
256
|
+
// importerGSTIN: { type: String, default: null }, // Default added
|
|
257
|
+
// eWasteCompliance: { type: Boolean, default: false }, // Default added
|
|
258
|
+
// recyclablePackaging: { type: Boolean, default: false }, // Default added
|
|
259
|
+
// hazardousMaterials: { type: String, default: null }, // Default added
|
|
260
|
+
// allowDropshipping: {
|
|
261
|
+
// type: Boolean,
|
|
262
|
+
// default: false,
|
|
263
|
+
// index: true,
|
|
264
|
+
// },
|
|
265
|
+
// commissionRate: {
|
|
266
|
+
// type: Number,
|
|
267
|
+
// min: [0, 'Commission rate cannot be negative.'],
|
|
268
|
+
// // max: [100, 'Commission rate cannot exceed 100%.'], // Max was 25, changed to 100 based on frontend
|
|
269
|
+
// max: [100, 'Commission rate cannot exceed 100%.'],
|
|
270
|
+
// default: null,
|
|
271
|
+
// // Removed Mongoose-level required validation dependent on allowDropshipping
|
|
272
|
+
// // Let application logic handle this if needed, or adjust validator
|
|
273
|
+
// // required: [
|
|
274
|
+
// // function () { return this.allowDropshipping === true; },
|
|
275
|
+
// // 'Commission rate is required when allowing dropshipping.'
|
|
276
|
+
// // ],
|
|
277
|
+
// // validate: { ... } // Keep or remove validation as needed
|
|
278
|
+
// },
|
|
279
|
+
// hasReturn: {
|
|
280
|
+
// type: Boolean,
|
|
281
|
+
// default: false
|
|
282
|
+
// },
|
|
283
|
+
// returnDays: {
|
|
284
|
+
// type: Number,
|
|
285
|
+
// min: 0,
|
|
286
|
+
// default: null
|
|
287
|
+
// },
|
|
288
|
+
// size: {
|
|
289
|
+
// type: String,
|
|
290
|
+
// default: null
|
|
291
|
+
// },
|
|
292
|
+
// isActive: {
|
|
293
|
+
// type: Boolean,
|
|
294
|
+
// default: true,
|
|
295
|
+
// },ratingSummary: {
|
|
296
|
+
// averageRating: { type: Number, default: 0 },
|
|
297
|
+
// totalRatings: { type: Number, default: 0 },
|
|
298
|
+
// ratingDistribution: {
|
|
299
|
+
// 1: { type: Number, default: 0 },
|
|
300
|
+
// 2: { type: Number, default: 0 },
|
|
301
|
+
// 3: { type: Number, default: 0 },
|
|
302
|
+
// 4: { type: Number, default: 0 },
|
|
303
|
+
// 5: { type: Number, default: 0 }
|
|
304
|
+
// }
|
|
305
|
+
// },
|
|
306
|
+
// totalReviews: { type: Number, default: 0 }
|
|
307
|
+
// },
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
// { timestamps: true }
|
|
312
|
+
// );
|
|
313
|
+
// ProductListingSchema.index({ title: 'text', description: 'text', category: 'text' });
|
|
314
|
+
// ProductListingSchema.index({ sellerId: 1, sku: 1 }, { unique: true });
|
|
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
|
+
|
|
323
|
+
|
package/package.json
CHANGED
package/test.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>HLS Player</title>
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<video width="640" height="360" controls autoplay>
|
|
8
|
+
<source src="https://d2jp9e7w3mhbvf.cloudfront.net/optimized/baab3401-1115-4a9c-97d5-85fad47eb8bd/master.m3u8" type="application/x-mpegURL">
|
|
9
|
+
Your browser does not support the video tag.
|
|
10
|
+
</video>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|