flykup_model_development 3.1.41 → 3.1.43

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.
@@ -6,41 +6,90 @@ const giveawayProductSchema = new Schema({
6
6
  productId: { type: Schema.Types.ObjectId, ref: "productlistings", required: true },
7
7
  productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
8
8
  productTitle: { type: String },
9
-
10
- // BGA Integration Fields
11
9
  giveawayObjectId: { type: Schema.Types.ObjectId, required: true, index: true },
12
10
  giveawayStatus: {
13
11
  type: String,
14
12
  enum: ['preparing', 'ready', 'active', 'ended', 'failed'],
15
13
  default: 'preparing'
16
14
  },
17
- requireAutoFollow: {
15
+ requireAutoFollow: {
18
16
  type: Boolean,
19
17
  default: false
20
18
  },
21
-
22
19
  activatedAt: { type: Date, default: null },
23
20
  createdAt: { type: Date, default: Date.now }
24
21
  });
25
22
 
23
+ // Live Flash Sale Schema
24
+ const liveFlashSaleSchema = new Schema({
25
+ _id: false,
26
+ productId: {
27
+ type: Schema.Types.ObjectId,
28
+ ref: "productlistings",
29
+ required: true
30
+ },
31
+ stockId: {
32
+ type: Schema.Types.ObjectId,
33
+ ref: "stocks",
34
+ required: true
35
+ },
36
+ flashPrice: {
37
+ type: Number,
38
+ required: true,
39
+ min: 1
40
+ },
41
+ duration: {
42
+ type: Number,
43
+ required: true,
44
+ enum: [10, 20, 30, 40, 50, 60]
45
+ },
46
+ initialStock: {
47
+ type: Number,
48
+ required: true,
49
+ min: 1
50
+ },
51
+ currentStock: {
52
+ type: Number,
53
+ required: true,
54
+ min: 0
55
+ },
56
+ sold: {
57
+ type: Number,
58
+ default: 0
59
+ },
60
+ status: {
61
+ type: String,
62
+ enum: ['scheduled', 'active', 'ended', 'cancelled'],
63
+ default: 'scheduled'
64
+ },
65
+ startTime: Date,
66
+ endTime: Date,
67
+ flashSaleId: {
68
+ type: Schema.Types.ObjectId,
69
+ ref: 'FlashSale'
70
+ },
71
+ createdAt: {
72
+ type: Date,
73
+ default: Date.now
74
+ }
75
+ });
26
76
  // Show Schema
27
77
  const showSchema = new Schema(
28
78
  {
29
-
30
- sellerId: { // <--- REMOVE or comment out this line
31
- type: mongoose.Schema.Types.ObjectId,
32
- ref: "sellers",
33
- },
79
+ sellerId: {
80
+ type: mongoose.Schema.Types.ObjectId,
81
+ ref: "sellers",
82
+ },
34
83
  // === Host Information ===
35
- host: { // Host (Seller or Dropshipper)
84
+ host: {
36
85
  type: mongoose.Schema.Types.ObjectId,
37
86
  required: true,
38
- refPath: 'hostModel' // Dynamic reference
87
+ refPath: 'hostModel'
39
88
  },
40
- hostModel: { // Type of host
89
+ hostModel: {
41
90
  type: String,
42
91
  required: true,
43
- enum: ['sellers', 'dropshippers'] // Allowed host types
92
+ enum: ['sellers', 'dropshippers']
44
93
  },
45
94
 
46
95
  title: {
@@ -55,7 +104,7 @@ const showSchema = new Schema(
55
104
  },
56
105
  scheduledAt: {
57
106
  type: Date,
58
- index: true // Add index for better query performance
107
+ index: true
59
108
  },
60
109
  category: {
61
110
  type: String,
@@ -75,11 +124,11 @@ const showSchema = new Schema(
75
124
  },
76
125
 
77
126
  thumbnailImage: {
78
- type: String, // URL or file path
127
+ type: String,
79
128
  default: null,
80
129
  },
81
130
  previewVideo: {
82
- type: String, // URL or file path
131
+ type: String,
83
132
  default: null,
84
133
  },
85
134
  language: {
@@ -90,21 +139,21 @@ const showSchema = new Schema(
90
139
  default: false,
91
140
  },
92
141
  streamUrl: {
93
- type: String, // URL for the live stream
142
+ type: String,
94
143
  default: null,
95
144
  },
96
145
 
97
- // === Stream Layout Configuration (NEW) ===
98
- orientation: {
99
- type: String,
100
- enum: ['horizontal', 'vertical'],
101
- default: 'horizontal'
102
- },
103
- layout: {
104
- type: String,
105
- enum: ['side-by-side', 'top-bottom'],
106
- default: 'side-by-side'
107
- },
146
+ // === Stream Layout Configuration ===
147
+ orientation: {
148
+ type: String,
149
+ enum: ['horizontal', 'vertical'],
150
+ default: 'horizontal'
151
+ },
152
+ layout: {
153
+ type: String,
154
+ enum: ['side-by-side', 'top-bottom'],
155
+ default: 'side-by-side'
156
+ },
108
157
 
109
158
  showStatus: {
110
159
  type: String,
@@ -127,7 +176,7 @@ layout: {
127
176
  _id: false,
128
177
  productId: { type: Schema.Types.ObjectId, ref: "productlistings" },
129
178
  productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
130
- productPrice: { type: Number, min: 0, default: null }, // Price set by host for this show
179
+ productPrice: { type: Number, min: 0, default: null },
131
180
  },
132
181
  ],
133
182
  default: [],
@@ -153,6 +202,17 @@ layout: {
153
202
  default: []
154
203
  },
155
204
 
205
+ // === LIVE FLASH SALE FIELDS (ADD THESE) ===
206
+ liveFlashSales: {
207
+ type: [liveFlashSaleSchema],
208
+ default: [] // This ensures it's always an array
209
+ },
210
+ currentFlashSale: {
211
+ type: Schema.Types.ObjectId,
212
+ ref: 'FlashSale',
213
+ default: null
214
+ },
215
+
156
216
  enabledProductTypes: {
157
217
  buyNow: { type: Boolean, default: false },
158
218
  auction: { type: Boolean, default: false },
@@ -185,4 +245,198 @@ showSchema.pre('save', function (next) {
185
245
 
186
246
  const Show = mongoose.model("shows", showSchema);
187
247
 
188
- export default Show;
248
+ export default Show;
249
+
250
+
251
+
252
+
253
+
254
+
255
+ // import mongoose from "mongoose";
256
+ // const { Schema } = mongoose;
257
+
258
+ // const giveawayProductSchema = new Schema({
259
+ // _id: false,
260
+ // productId: { type: Schema.Types.ObjectId, ref: "productlistings", required: true },
261
+ // productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
262
+ // productTitle: { type: String },
263
+
264
+ // // BGA Integration Fields
265
+ // giveawayObjectId: { type: Schema.Types.ObjectId, required: true, index: true },
266
+ // giveawayStatus: {
267
+ // type: String,
268
+ // enum: ['preparing', 'ready', 'active', 'ended', 'failed'],
269
+ // default: 'preparing'
270
+ // },
271
+ // requireAutoFollow: {
272
+ // type: Boolean,
273
+ // default: false
274
+ // },
275
+
276
+ // activatedAt: { type: Date, default: null },
277
+ // createdAt: { type: Date, default: Date.now }
278
+ // });
279
+
280
+ // // Show Schema
281
+ // const showSchema = new Schema(
282
+ // {
283
+
284
+ // sellerId: { // <--- REMOVE or comment out this line
285
+ // type: mongoose.Schema.Types.ObjectId,
286
+ // ref: "sellers",
287
+ // },
288
+ // // === Host Information ===
289
+ // host: { // Host (Seller or Dropshipper)
290
+ // type: mongoose.Schema.Types.ObjectId,
291
+ // required: true,
292
+ // refPath: 'hostModel' // Dynamic reference
293
+ // },
294
+ // hostModel: { // Type of host
295
+ // type: String,
296
+ // required: true,
297
+ // enum: ['sellers', 'dropshippers'] // Allowed host types
298
+ // },
299
+
300
+ // title: {
301
+ // type: String,
302
+ // required: true,
303
+ // },
304
+ // date: {
305
+ // type: Date,
306
+ // },
307
+ // time: {
308
+ // type: String,
309
+ // },
310
+ // scheduledAt: {
311
+ // type: Date,
312
+ // index: true // Add index for better query performance
313
+ // },
314
+ // category: {
315
+ // type: String,
316
+ // },
317
+ // subCategory: {
318
+ // type: String,
319
+ // default: '',
320
+ // },
321
+ // liveStreamId: { type: String, default: null },
322
+ // streamName: {
323
+ // type: String,
324
+ // default: ''
325
+ // },
326
+ // tags: {
327
+ // type: [String],
328
+ // default: [],
329
+ // },
330
+
331
+ // thumbnailImage: {
332
+ // type: String, // URL or file path
333
+ // default: null,
334
+ // },
335
+ // previewVideo: {
336
+ // type: String, // URL or file path
337
+ // default: null,
338
+ // },
339
+ // language: {
340
+ // type: String,
341
+ // },
342
+ // isLive: {
343
+ // type: Boolean,
344
+ // default: false,
345
+ // },
346
+ // streamUrl: {
347
+ // type: String, // URL for the live stream
348
+ // default: null,
349
+ // },
350
+
351
+ // // === Stream Layout Configuration (NEW) ===
352
+ // orientation: {
353
+ // type: String,
354
+ // enum: ['horizontal', 'vertical'],
355
+ // default: 'horizontal'
356
+ // },
357
+ // layout: {
358
+ // type: String,
359
+ // enum: ['side-by-side', 'top-bottom'],
360
+ // default: 'side-by-side'
361
+ // },
362
+
363
+ // showStatus: {
364
+ // type: String,
365
+ // enum: ['created', 'live', 'cancelled', 'ended'],
366
+ // default: 'created'
367
+ // },
368
+ // likes: {
369
+ // type: Number,
370
+ // default: 0,
371
+ // },
372
+ // likedBy: {
373
+ // type: [mongoose.Schema.Types.ObjectId],
374
+ // ref: 'users',
375
+ // default: [],
376
+ // },
377
+
378
+ // buyNowProducts: {
379
+ // type: [
380
+ // {
381
+ // _id: false,
382
+ // productId: { type: Schema.Types.ObjectId, ref: "productlistings" },
383
+ // productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
384
+ // productPrice: { type: Number, min: 0, default: null }, // Price set by host for this show
385
+ // },
386
+ // ],
387
+ // default: [],
388
+ // },
389
+ // auctionProducts: {
390
+ // type: [
391
+ // {
392
+ // _id: false,
393
+ // productId: { type: Schema.Types.ObjectId, ref: "productlistings" },
394
+ // productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
395
+ // startingPrice: { type: Number, min: 0, default: null },
396
+ // reservedPrice: { type: Number, min: 0, default: null },
397
+ // auctionNumber: {
398
+ // type: Number,
399
+ // }
400
+ // },
401
+ // ],
402
+ // default: [],
403
+ // },
404
+
405
+ // giveawayProducts: {
406
+ // type: [giveawayProductSchema],
407
+ // default: []
408
+ // },
409
+
410
+ // enabledProductTypes: {
411
+ // buyNow: { type: Boolean, default: false },
412
+ // auction: { type: Boolean, default: false },
413
+ // giveaway: { type: Boolean, default: false }
414
+ // },
415
+ // notes: {
416
+ // type: String,
417
+ // default: ''
418
+ // },
419
+ // },
420
+ // { timestamps: true }
421
+ // );
422
+
423
+ // showSchema.pre('save', function (next) {
424
+ // const doc = this;
425
+
426
+ // // Set liveDrop based on product types
427
+ // const hasBuyNow = doc.buyNowProducts && doc.buyNowProducts.length > 0;
428
+ // const hasAuction = doc.auctionProducts && doc.auctionProducts.length > 0;
429
+ // const hasGiveaway = doc.giveawayProducts && doc.giveawayProducts.length > 0;
430
+ // doc.liveDrop = hasBuyNow && hasAuction && hasGiveaway;
431
+
432
+ // // Ensure coHost is null if hasCoHost is false
433
+ // if (!doc.hasCoHost) {
434
+ // doc.coHost = null;
435
+ // }
436
+
437
+ // next();
438
+ // });
439
+
440
+ // const Show = mongoose.model("shows", showSchema);
441
+
442
+ // export default Show;
@@ -49,7 +49,6 @@ const UserSchema = new mongoose.Schema(
49
49
  },
50
50
  maxLength: 120,
51
51
  },
52
- mobile: { type: String, trim: true, maxLength: 15 },
53
52
  isEmailVerified: { type: Boolean, default: false },
54
53
  role: {
55
54
  type: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "3.1.41",
3
+ "version": "3.1.43",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,