flykup_model_development 2.0.5 → 2.0.7
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 +13 -2
- package/models/productListing.model.js +40 -26
- package/models/seller.model.js +2 -1
- package/models/user.model.js +4 -0
- package/package.json +1 -1
package/models/order.modal.js
CHANGED
|
@@ -48,6 +48,17 @@ const orderSchema = new mongoose.Schema(
|
|
|
48
48
|
type: String,
|
|
49
49
|
enum: ['CGST+SGST', 'IGST',"NON-GST"],
|
|
50
50
|
required: true
|
|
51
|
+
},
|
|
52
|
+
isFlashSale: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
flashSaleId: {
|
|
57
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
58
|
+
ref: 'FlashSale'
|
|
59
|
+
},
|
|
60
|
+
flashPrice: {
|
|
61
|
+
type: Number
|
|
51
62
|
}
|
|
52
63
|
}],
|
|
53
64
|
totalBaseAmount: {
|
|
@@ -166,9 +177,9 @@ const orderSchema = new mongoose.Schema(
|
|
|
166
177
|
// default: 'ORDERED', // Default should be the initial state
|
|
167
178
|
required: true
|
|
168
179
|
},
|
|
169
|
-
|
|
180
|
+
sourceType: {
|
|
170
181
|
type: String,
|
|
171
|
-
enum: ['static', 'shoppable_video', 'livestream', 'auction'],
|
|
182
|
+
enum: ['static', 'shoppable_video', 'livestream', 'auction', 'flash_sale'], // Add flash_sale
|
|
172
183
|
required: true
|
|
173
184
|
},
|
|
174
185
|
sourceRefId: String,
|
|
@@ -11,7 +11,7 @@ const ProductListingSchema = new Schema(
|
|
|
11
11
|
images: [
|
|
12
12
|
{
|
|
13
13
|
key: { type: String, maxLength: 255, default: null },
|
|
14
|
-
}
|
|
14
|
+
},
|
|
15
15
|
],
|
|
16
16
|
category: String,
|
|
17
17
|
subcategory: String,
|
|
@@ -44,11 +44,13 @@ const ProductListingSchema = new Schema(
|
|
|
44
44
|
countryOfOrigin: String,
|
|
45
45
|
netQuantity: { type: String, default: null }, // ADDED (String to accommodate units like '500g')
|
|
46
46
|
packagingType: { type: String, default: null }, // ADDED
|
|
47
|
-
weight: {
|
|
47
|
+
weight: {
|
|
48
|
+
// For shipping calculations
|
|
48
49
|
value: { type: Number, default: null },
|
|
49
50
|
unit: { type: String, default: null },
|
|
50
51
|
},
|
|
51
|
-
dimensions: {
|
|
52
|
+
dimensions: {
|
|
53
|
+
// For shipping calculations
|
|
52
54
|
length: { type: Number, default: null },
|
|
53
55
|
width: { type: Number, default: null },
|
|
54
56
|
height: { type: Number, default: null },
|
|
@@ -80,9 +82,9 @@ const ProductListingSchema = new Schema(
|
|
|
80
82
|
},
|
|
81
83
|
commissionRate: {
|
|
82
84
|
type: Number,
|
|
83
|
-
min: [0,
|
|
85
|
+
min: [0, "Commission rate cannot be negative."],
|
|
84
86
|
// max: [100, 'Commission rate cannot exceed 100%.'], // Max was 25, changed to 100 based on frontend
|
|
85
|
-
max: [100,
|
|
87
|
+
max: [100, "Commission rate cannot exceed 100%."],
|
|
86
88
|
default: null,
|
|
87
89
|
// Removed Mongoose-level required validation dependent on allowDropshipping
|
|
88
90
|
// Let application logic handle this if needed, or adjust validator
|
|
@@ -93,33 +95,43 @@ const ProductListingSchema = new Schema(
|
|
|
93
95
|
// validate: { ... } // Keep or remove validation as needed
|
|
94
96
|
},
|
|
95
97
|
hasReturn: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
returnDays: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
size: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: false,
|
|
100
|
+
},
|
|
101
|
+
returnDays: {
|
|
102
|
+
type: Number,
|
|
103
|
+
min: 0,
|
|
104
|
+
default: null,
|
|
105
|
+
},
|
|
106
|
+
size: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: null,
|
|
109
|
+
},
|
|
108
110
|
isActive: {
|
|
109
111
|
type: Boolean,
|
|
110
112
|
default: true,
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
},
|
|
114
|
+
ratingSummary: {
|
|
115
|
+
averageRating: { type: Number, default: 0 },
|
|
116
|
+
totalRatings: { type: Number, default: 0 },
|
|
117
|
+
ratingDistribution: {
|
|
115
118
|
1: { type: Number, default: 0 },
|
|
116
119
|
2: { type: Number, default: 0 },
|
|
117
120
|
3: { type: Number, default: 0 },
|
|
118
121
|
4: { type: Number, default: 0 },
|
|
119
|
-
5: { type: Number, default: 0 }
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
|
|
122
|
+
5: { type: Number, default: 0 },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
flashSale: {
|
|
126
|
+
isActive: { type: Boolean, default: false },
|
|
127
|
+
flashSaleId: { type: mongoose.Schema.Types.ObjectId, ref: 'FlashSale' },
|
|
128
|
+
flashPrice: { type: Number, default: null },
|
|
129
|
+
flashStock: { type: Number, default: 0 },
|
|
130
|
+
originalPrice: { type: Number, default: null },
|
|
131
|
+
endsAt: { type: Date, default: null },
|
|
132
|
+
startsAt: { type: Date, default: null }
|
|
133
|
+
},
|
|
134
|
+
totalReviews: { type: Number, default: 0 },
|
|
123
135
|
},
|
|
124
136
|
{ timestamps: true }
|
|
125
137
|
);
|
|
@@ -128,5 +140,7 @@ totalReviews: { type: Number, default: 0 }
|
|
|
128
140
|
// ProductListingSchema.set('strict', false); // Use with caution
|
|
129
141
|
|
|
130
142
|
// Safe export to prevent OverwriteModelError
|
|
131
|
-
const ProductListing =
|
|
143
|
+
const ProductListing =
|
|
144
|
+
mongoose.models.productlistings ||
|
|
145
|
+
mongoose.model("productlistings", ProductListingSchema);
|
|
132
146
|
export default ProductListing;
|
package/models/seller.model.js
CHANGED
package/models/user.model.js
CHANGED
|
@@ -93,6 +93,10 @@ const UserSchema = new mongoose.Schema(
|
|
|
93
93
|
},
|
|
94
94
|
],
|
|
95
95
|
filledNewSellerForm: { type: Boolean, default: false },
|
|
96
|
+
sellerApplicationDraft: {
|
|
97
|
+
type: Schema.Types.Mixed,
|
|
98
|
+
default: null,
|
|
99
|
+
},
|
|
96
100
|
|
|
97
101
|
// --- Verification Flow Fields ---
|
|
98
102
|
verificationFlowStatus: {
|