flykup_model_development 3.1.15 → 3.1.16
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 +2 -1
- package/models/shows.model.js +18 -166
- package/package.json +1 -1
package/models/order.modal.js
CHANGED
|
@@ -8,7 +8,7 @@ const orderSchema = new mongoose.Schema(
|
|
|
8
8
|
type: String,
|
|
9
9
|
required: true,
|
|
10
10
|
unique: true,
|
|
11
|
-
default: () => `
|
|
11
|
+
default: () => `ORD-${nanoid(8)}`
|
|
12
12
|
},
|
|
13
13
|
userId: {
|
|
14
14
|
type: mongoose.Schema.Types.ObjectId,
|
|
@@ -182,6 +182,7 @@ const orderSchema = new mongoose.Schema(
|
|
|
182
182
|
sourceRefId: String,
|
|
183
183
|
deliveryCharge: {
|
|
184
184
|
type: Number,
|
|
185
|
+
default: 40
|
|
185
186
|
},
|
|
186
187
|
statusTimeline: {
|
|
187
188
|
ordered: Date,
|
package/models/shows.model.js
CHANGED
|
@@ -1,99 +1,6 @@
|
|
|
1
1
|
import mongoose from "mongoose";
|
|
2
2
|
const { Schema } = mongoose;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
// Comment Schema
|
|
6
|
-
const commentSchema = new Schema({
|
|
7
|
-
user: {
|
|
8
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
9
|
-
ref: "users", // Reference to the User model
|
|
10
|
-
},
|
|
11
|
-
text: {
|
|
12
|
-
type: String,
|
|
13
|
-
},
|
|
14
|
-
timeStamp: {
|
|
15
|
-
type: Date,
|
|
16
|
-
default: Date.now,
|
|
17
|
-
},
|
|
18
|
-
createdAt: {
|
|
19
|
-
type: Date,
|
|
20
|
-
default: Date.now,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const bidSchema = new mongoose.Schema({
|
|
25
|
-
user: {
|
|
26
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
27
|
-
ref: "users", // Reference to the User model
|
|
28
|
-
required: true,
|
|
29
|
-
},
|
|
30
|
-
amount: {
|
|
31
|
-
type: Number,
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
createdAt: {
|
|
35
|
-
type: Date,
|
|
36
|
-
default: Date.now,
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Auction Schema
|
|
41
|
-
const auctionSchema = new mongoose.Schema(
|
|
42
|
-
{
|
|
43
|
-
streamId: {
|
|
44
|
-
type: String,
|
|
45
|
-
required: true,
|
|
46
|
-
},
|
|
47
|
-
product: {
|
|
48
|
-
type: String,
|
|
49
|
-
},
|
|
50
|
-
auctionType: {
|
|
51
|
-
type: String, // 'default' or other types
|
|
52
|
-
},
|
|
53
|
-
startingBid: {
|
|
54
|
-
type: Number,
|
|
55
|
-
},
|
|
56
|
-
increment: {
|
|
57
|
-
type: Number,
|
|
58
|
-
default: 500,
|
|
59
|
-
},
|
|
60
|
-
currentHighestBid: {
|
|
61
|
-
type: Number,
|
|
62
|
-
default: 0,
|
|
63
|
-
},
|
|
64
|
-
nextBid1: {
|
|
65
|
-
type: Number,
|
|
66
|
-
default: 0,
|
|
67
|
-
},
|
|
68
|
-
nextBid2: {
|
|
69
|
-
type: Number,
|
|
70
|
-
default: 0,
|
|
71
|
-
},
|
|
72
|
-
highestBidder: {
|
|
73
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
74
|
-
ref: "users", // Store reference to the highest bidder
|
|
75
|
-
default: null,
|
|
76
|
-
},
|
|
77
|
-
bidderWon: {
|
|
78
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
79
|
-
ref: "users", // Store reference to the highest bidder
|
|
80
|
-
default: null,
|
|
81
|
-
},
|
|
82
|
-
bids: [bidSchema], // Array of bids
|
|
83
|
-
endsAt: {
|
|
84
|
-
type: Date,
|
|
85
|
-
},
|
|
86
|
-
isActive: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: true,
|
|
89
|
-
},
|
|
90
|
-
uniqueStreamId: {
|
|
91
|
-
type: String,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{ timestamps: true }
|
|
95
|
-
);
|
|
96
|
-
|
|
97
4
|
const giveawayProductSchema = new Schema({
|
|
98
5
|
_id: false,
|
|
99
6
|
productId: { type: Schema.Types.ObjectId, ref: "productlistings", required: true },
|
|
@@ -119,22 +26,22 @@ const giveawayProductSchema = new Schema({
|
|
|
119
26
|
// Show Schema
|
|
120
27
|
const showSchema = new Schema(
|
|
121
28
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
29
|
+
|
|
30
|
+
sellerId: { // <--- REMOVE or comment out this line
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: "sellers",
|
|
33
|
+
},
|
|
34
|
+
// === Host Information ===
|
|
35
|
+
host: { // Host (Seller or Dropshipper)
|
|
128
36
|
type: mongoose.Schema.Types.ObjectId,
|
|
129
37
|
required: true,
|
|
130
38
|
refPath: 'hostModel' // Dynamic reference
|
|
131
39
|
},
|
|
132
|
-
hostModel: { //
|
|
40
|
+
hostModel: { // Type of host
|
|
133
41
|
type: String,
|
|
134
42
|
required: true,
|
|
135
43
|
enum: ['sellers', 'dropshippers'] // Allowed host types
|
|
136
44
|
},
|
|
137
|
-
// === MODIFIED END: Host Information ===
|
|
138
45
|
|
|
139
46
|
title: {
|
|
140
47
|
type: String,
|
|
@@ -191,7 +98,6 @@ const showSchema = new Schema(
|
|
|
191
98
|
enum: ['created', 'live', 'cancelled', 'ended'],
|
|
192
99
|
default: 'created'
|
|
193
100
|
},
|
|
194
|
-
comments: [commentSchema], // Array of comments
|
|
195
101
|
likes: {
|
|
196
102
|
type: Number,
|
|
197
103
|
default: 0,
|
|
@@ -201,14 +107,16 @@ const showSchema = new Schema(
|
|
|
201
107
|
ref: 'users',
|
|
202
108
|
default: [],
|
|
203
109
|
},
|
|
204
|
-
|
|
205
|
-
|
|
110
|
+
currentAuction: {
|
|
111
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
112
|
+
ref: 'auctions',
|
|
113
|
+
default: null
|
|
114
|
+
},
|
|
206
115
|
buyNowProducts: {
|
|
207
116
|
type: [
|
|
208
117
|
{
|
|
209
118
|
_id: false,
|
|
210
119
|
productId: { type: Schema.Types.ObjectId, ref: "productlistings" },
|
|
211
|
-
// --- ADDED productOwnerSellerId ---
|
|
212
120
|
productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
|
|
213
121
|
productPrice: { type: Number, min: 0, default: null }, // Price set by host for this show
|
|
214
122
|
},
|
|
@@ -220,64 +128,10 @@ const showSchema = new Schema(
|
|
|
220
128
|
{
|
|
221
129
|
_id: false,
|
|
222
130
|
productId: { type: Schema.Types.ObjectId, ref: "productlistings" },
|
|
223
|
-
// --- ADDED productOwnerSellerId ---
|
|
224
131
|
productOwnerSellerId: { type: Schema.Types.ObjectId, ref: 'sellers', required: true },
|
|
225
132
|
startingPrice: { type: Number, min: 0, default: null },
|
|
226
133
|
reservedPrice: { type: Number, min: 0, default: null },
|
|
227
|
-
|
|
228
|
-
type: Boolean,
|
|
229
|
-
default: false
|
|
230
|
-
},
|
|
231
|
-
streamId: {
|
|
232
|
-
type: String,
|
|
233
|
-
},
|
|
234
|
-
// product: {
|
|
235
|
-
// type: String,
|
|
236
|
-
// },
|
|
237
|
-
auctionType: {
|
|
238
|
-
type: String, // 'default' or other types
|
|
239
|
-
},
|
|
240
|
-
startingBid: {
|
|
241
|
-
type: Number,
|
|
242
|
-
},
|
|
243
|
-
increment: {
|
|
244
|
-
type: Number,
|
|
245
|
-
default: 5,
|
|
246
|
-
},
|
|
247
|
-
currentHighestBid: {
|
|
248
|
-
type: Number,
|
|
249
|
-
default: 0,
|
|
250
|
-
},
|
|
251
|
-
nextBid1: {
|
|
252
|
-
type: Number,
|
|
253
|
-
default: 0,
|
|
254
|
-
},
|
|
255
|
-
nextBid2: {
|
|
256
|
-
type: Number,
|
|
257
|
-
default: 0,
|
|
258
|
-
},
|
|
259
|
-
highestBidder: {
|
|
260
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
261
|
-
ref: "users", // Store reference to the highest bidder
|
|
262
|
-
default: null,
|
|
263
|
-
},
|
|
264
|
-
bidderWon: {
|
|
265
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
266
|
-
ref: "users", // Store reference to the highest bidder
|
|
267
|
-
default: null,
|
|
268
|
-
},
|
|
269
|
-
bids: [bidSchema], // Array of bids
|
|
270
|
-
endsAt: {
|
|
271
|
-
type: Date,
|
|
272
|
-
},
|
|
273
|
-
isActive: {
|
|
274
|
-
type: Boolean,
|
|
275
|
-
default: true,
|
|
276
|
-
},
|
|
277
|
-
uniqueStreamId: {
|
|
278
|
-
type: String,
|
|
279
|
-
},
|
|
280
|
-
auctionNumber: { // <-- New field in auctionProducts sub-schema
|
|
134
|
+
auctionNumber: {
|
|
281
135
|
type: Number,
|
|
282
136
|
}
|
|
283
137
|
},
|
|
@@ -291,16 +145,14 @@ const showSchema = new Schema(
|
|
|
291
145
|
},
|
|
292
146
|
|
|
293
147
|
enabledProductTypes: {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
,
|
|
148
|
+
buyNow: { type: Boolean, default: false },
|
|
149
|
+
auction: { type: Boolean, default: false },
|
|
150
|
+
giveaway: { type: Boolean, default: false }
|
|
151
|
+
},
|
|
299
152
|
notes: {
|
|
300
153
|
type: String,
|
|
301
154
|
default: ''
|
|
302
155
|
},
|
|
303
|
-
// giveaways: [giveawaySchema], // Array of giveaways
|
|
304
156
|
},
|
|
305
157
|
{ timestamps: true }
|
|
306
158
|
);
|