flykup_model_development 3.1.3 → 3.1.4
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.
|
@@ -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,13 +44,11 @@ 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: {
|
|
48
|
-
// For shipping calculations
|
|
47
|
+
weight: { // For shipping calculations
|
|
49
48
|
value: { type: Number, default: null },
|
|
50
49
|
unit: { type: String, default: null },
|
|
51
50
|
},
|
|
52
|
-
dimensions: {
|
|
53
|
-
// For shipping calculations
|
|
51
|
+
dimensions: { // For shipping calculations
|
|
54
52
|
length: { type: Number, default: null },
|
|
55
53
|
width: { type: Number, default: null },
|
|
56
54
|
height: { type: Number, default: null },
|
|
@@ -82,9 +80,9 @@ const ProductListingSchema = new Schema(
|
|
|
82
80
|
},
|
|
83
81
|
commissionRate: {
|
|
84
82
|
type: Number,
|
|
85
|
-
min: [0,
|
|
83
|
+
min: [0, 'Commission rate cannot be negative.'],
|
|
86
84
|
// max: [100, 'Commission rate cannot exceed 100%.'], // Max was 25, changed to 100 based on frontend
|
|
87
|
-
max: [100,
|
|
85
|
+
max: [100, 'Commission rate cannot exceed 100%.'],
|
|
88
86
|
default: null,
|
|
89
87
|
// Removed Mongoose-level required validation dependent on allowDropshipping
|
|
90
88
|
// Let application logic handle this if needed, or adjust validator
|
|
@@ -95,52 +93,37 @@ const ProductListingSchema = new Schema(
|
|
|
95
93
|
// validate: { ... } // Keep or remove validation as needed
|
|
96
94
|
},
|
|
97
95
|
hasReturn: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
returnDays: {
|
|
100
|
+
type: Number,
|
|
101
|
+
min: 0,
|
|
102
|
+
default: null
|
|
103
|
+
},
|
|
104
|
+
size: {
|
|
105
|
+
type: String,
|
|
106
|
+
default: null
|
|
107
|
+
},
|
|
110
108
|
isActive: {
|
|
111
109
|
type: Boolean,
|
|
112
110
|
default: true,
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
ratingDistribution: {
|
|
111
|
+
},ratingSummary: {
|
|
112
|
+
averageRating: { type: Number, default: 0 },
|
|
113
|
+
totalRatings: { type: Number, default: 0 },
|
|
114
|
+
ratingDistribution: {
|
|
118
115
|
1: { type: Number, default: 0 },
|
|
119
116
|
2: { type: Number, default: 0 },
|
|
120
117
|
3: { type: Number, default: 0 },
|
|
121
118
|
4: { type: Number, default: 0 },
|
|
122
|
-
5: { type: Number, default: 0 }
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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 },
|
|
119
|
+
5: { type: Number, default: 0 }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
totalReviews: { type: Number, default: 0 }
|
|
135
123
|
},
|
|
136
124
|
{ timestamps: true }
|
|
137
125
|
);
|
|
138
126
|
|
|
139
|
-
// Optional: Ensure strict mode is not preventing fields if you intended flexibility (default is true)
|
|
140
|
-
// ProductListingSchema.set('strict', false); // Use with caution
|
|
141
|
-
|
|
142
127
|
// Safe export to prevent OverwriteModelError
|
|
143
|
-
const ProductListing =
|
|
144
|
-
mongoose.models.productlistings ||
|
|
145
|
-
mongoose.model("productlistings", ProductListingSchema);
|
|
128
|
+
const ProductListing = mongoose.models.productlistings || mongoose.model("productlistings", ProductListingSchema);
|
|
146
129
|
export default ProductListing;
|