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