flykup_model_development 1.0.1 → 1.0.2
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/AdminEmail.model.js +4 -1
- package/models/LiveStreamInteraction.model.js +3 -5
- package/models/ProductInteraction.model.js +3 -3
- package/models/Review.model.js +3 -3
- package/models/SearchAnalytics.js +3 -2
- package/models/ShoppableInteraction.model.js +2 -3
- package/models/Wishlist.model.js +2 -3
- package/models/admin.model.js +1 -1
- package/models/appUpdate.model.js +3 -1
- package/models/assets.model.js +1 -2
- package/models/blockedRegion.models.js +1 -1
- package/models/category.model.js +1 -1
- package/models/chat.model.js +6 -6
- package/models/coHostInvitation.model.js +2 -1
- package/models/follow.model.js +2 -1
- package/models/loginlogs.model.js +2 -1
- package/models/notification.model.js +2 -2
- package/models/order.modal.js +2 -5
- package/models/productListing.model.js +3 -3
- package/models/profileInteractions.model.js +3 -4
- package/models/registerShow.model.js +2 -1
- package/models/seller.model.js +2 -3
- package/models/settings.model.js +1 -2
- package/models/shipper.model.js +2 -4
- package/models/shoppableVideo.model.js +2 -2
- package/models/shoppableVideoComment.model.js +2 -2
- package/models/shoppableVideoLike.model.js +2 -3
- package/models/shoppableVideoSave.model.js +2 -3
- package/models/shows.model.js +2 -3
- package/models/stock.model.js +3 -5
- package/models/ticket.model.js +1 -1
- package/package.json +1 -1
|
@@ -33,4 +33,7 @@ const AdminEmailSchema = new Schema({
|
|
|
33
33
|
// Index for faster querying
|
|
34
34
|
AdminEmailSchema.index({ email: 1, isActive: 1 });
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// Export safely
|
|
37
|
+
const AdminEmail = mongoose.models.AdminEmail || mongoose.model('AdminEmail', AdminEmailSchema);
|
|
38
|
+
|
|
39
|
+
export default AdminEmail;
|
|
@@ -85,9 +85,7 @@ liveStreamInteractionSchema.index({ show: 1, sessionIdentifier: 1 }, {
|
|
|
85
85
|
|
|
86
86
|
liveStreamInteractionSchema.index({ show: 1, createdAt: -1 });
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
liveStreamInteractionSchema
|
|
91
|
-
);
|
|
88
|
+
// Safe export to prevent OverwriteModelError
|
|
89
|
+
const LiveStreamInteraction = mongoose.models.LiveStreamInteraction || mongoose.model('LiveStreamInteraction', liveStreamInteractionSchema);
|
|
92
90
|
|
|
93
|
-
export default LiveStreamInteraction;
|
|
91
|
+
export default LiveStreamInteraction;
|
|
@@ -37,6 +37,6 @@ productInteractionSchema.index({ product: 1, user: 1 }, { unique: true, partialF
|
|
|
37
37
|
// Additional indexes for performance
|
|
38
38
|
productInteractionSchema.index({ createdAt: -1 });
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export default ProductInteraction;
|
|
40
|
+
// Safe export to prevent OverwriteModelError
|
|
41
|
+
const ProductInteraction = mongoose.models.ProductInteraction || mongoose.model('ProductInteraction', productInteractionSchema);
|
|
42
|
+
export default ProductInteraction;
|
package/models/Review.model.js
CHANGED
|
@@ -116,6 +116,6 @@ ReviewSchema.methods.getUserVoteType = function(userId) {
|
|
|
116
116
|
return vote ? vote.voteType : null;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export { Review, ReviewType };
|
|
119
|
+
// Safe export to prevent OverwriteModelError
|
|
120
|
+
const Review = mongoose.models.reviews || mongoose.model("reviews", ReviewSchema);
|
|
121
|
+
export { Review, ReviewType };
|
|
@@ -18,5 +18,6 @@ const searchAnalyticsSchema = new mongoose.Schema({
|
|
|
18
18
|
},
|
|
19
19
|
createdAt: { type: Date, default: Date.now }
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// Safe export to prevent OverwriteModelError
|
|
22
|
+
const SearchAnalytics = mongoose.models.SearchAnalytics || mongoose.model("SearchAnalytics", searchAnalyticsSchema);
|
|
23
|
+
export default SearchAnalytics;
|
|
@@ -81,9 +81,8 @@ shoppableVideoInteractionSchema.index({ video: 1, sessionIdentifier: 1 }, {
|
|
|
81
81
|
// Additional indexes for fast analytic queries
|
|
82
82
|
shoppableVideoInteractionSchema.index({ video: 1, createdAt: -1 });
|
|
83
83
|
|
|
84
|
-
const ShoppableVideoInteraction = mongoose.model(
|
|
84
|
+
const ShoppableVideoInteraction = mongoose.models.ShoppableVideoInteraction || mongoose.model(
|
|
85
85
|
'ShoppableVideoInteraction',
|
|
86
86
|
shoppableVideoInteractionSchema
|
|
87
87
|
);
|
|
88
|
-
|
|
89
|
-
export default ShoppableVideoInteraction;
|
|
88
|
+
export default ShoppableVideoInteraction;
|
package/models/Wishlist.model.js
CHANGED
|
@@ -25,6 +25,5 @@ const WishlistSchema = new Schema(
|
|
|
25
25
|
// Add compound index to prevent duplicate entries
|
|
26
26
|
WishlistSchema.index({ userId: 1, productId: 1 }, { unique: true });
|
|
27
27
|
|
|
28
|
-
const Wishlist = mongoose.model("wishlists", WishlistSchema);
|
|
29
|
-
|
|
30
|
-
export default Wishlist;
|
|
28
|
+
const Wishlist = mongoose.models.Wishlist || mongoose.model("wishlists", WishlistSchema);
|
|
29
|
+
export default Wishlist;
|
package/models/admin.model.js
CHANGED
package/models/assets.model.js
CHANGED
|
@@ -28,5 +28,4 @@ const assetSchema = new mongoose.Schema({
|
|
|
28
28
|
|
|
29
29
|
assetSchema.plugin(mongoosePaginate);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
export const AssetsModel = mongoose.model('Asset', assetSchema);
|
|
31
|
+
export const AssetsModel = mongoose.models.Asset || mongoose.model('Asset', assetSchema);
|
|
@@ -22,6 +22,6 @@ const blockedRegionSchema = new mongoose.Schema({
|
|
|
22
22
|
timestamps: true
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const BlockedRegion = mongoose.model('BlockedRegion', blockedRegionSchema);
|
|
25
|
+
const BlockedRegion = mongoose.models.BlockedRegion || mongoose.model('BlockedRegion', blockedRegionSchema);
|
|
26
26
|
|
|
27
27
|
export default BlockedRegion;
|
package/models/category.model.js
CHANGED
|
@@ -24,6 +24,6 @@ const CategorySchema = new mongoose.Schema({
|
|
|
24
24
|
subcategories: [SubcategorySchema],
|
|
25
25
|
}, { timestamps: true });
|
|
26
26
|
|
|
27
|
-
const Category = mongoose.model('Category', CategorySchema);
|
|
27
|
+
const Category = mongoose.models.Category || mongoose.model('Category', CategorySchema);
|
|
28
28
|
|
|
29
29
|
export default Category;
|
package/models/chat.model.js
CHANGED
|
@@ -487,10 +487,10 @@ ChatRoomMemberSchema.index({ userId: 1, status: 1 });
|
|
|
487
487
|
|
|
488
488
|
ChatBlockSchema.index({ blockerId: 1, blockedUserId: 1 });
|
|
489
489
|
|
|
490
|
-
// Models
|
|
491
|
-
const ChatRoom = mongoose.model('chatrooms', ChatRoomSchema);
|
|
492
|
-
const ChatMessage = mongoose.model('chatmessages', ChatMessageSchema);
|
|
493
|
-
const ChatRoomMember = mongoose.model('chatroommembers', ChatRoomMemberSchema);
|
|
494
|
-
const ChatBlock = mongoose.model('chatblocks', ChatBlockSchema);
|
|
490
|
+
// Models with safe exports to prevent OverwriteModelError
|
|
491
|
+
const ChatRoom = mongoose.models.chatrooms || mongoose.model('chatrooms', ChatRoomSchema);
|
|
492
|
+
const ChatMessage = mongoose.models.chatmessages || mongoose.model('chatmessages', ChatMessageSchema);
|
|
493
|
+
const ChatRoomMember = mongoose.models.chatroommembers || mongoose.model('chatroommembers', ChatRoomMemberSchema);
|
|
494
|
+
const ChatBlock = mongoose.models.chatblocks || mongoose.model('chatblocks', ChatBlockSchema);
|
|
495
495
|
|
|
496
|
-
export { ChatRoom, ChatMessage, ChatRoomMember, ChatBlock };
|
|
496
|
+
export { ChatRoom, ChatMessage, ChatRoomMember, ChatBlock };
|
|
@@ -51,6 +51,7 @@ const coHostInviteSchema = new Schema(
|
|
|
51
51
|
coHostInviteSchema.index({ show: 1, status: 1 });
|
|
52
52
|
coHostInviteSchema.index({ "cohost.userId": 1, status: 1 });
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// Safe export to prevent OverwriteModelError
|
|
55
|
+
const CoHostInvite = mongoose.models.cohostinvites || mongoose.model("cohostinvites", coHostInviteSchema);
|
|
55
56
|
|
|
56
57
|
export default CoHostInvite;
|
package/models/follow.model.js
CHANGED
|
@@ -32,6 +32,7 @@ FollowSchema.pre('save', function(next) {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// Safe export to prevent OverwriteModelError
|
|
36
|
+
const Follow = mongoose.models.follows || mongoose.model("follows", FollowSchema);
|
|
36
37
|
|
|
37
38
|
export default Follow;
|
|
@@ -20,6 +20,7 @@ const loginLogSchema = new mongoose.Schema({
|
|
|
20
20
|
time: { type: Date, default: Date.now }
|
|
21
21
|
}, { timestamps: true });
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
// Safe export to prevent OverwriteModelError
|
|
24
|
+
const LoginLog = mongoose.models.LoginLog || mongoose.model('LoginLog', loginLogSchema);
|
|
24
25
|
|
|
25
26
|
export default LoginLog;
|
|
@@ -111,6 +111,6 @@ const notificationSchema = new mongoose.Schema(
|
|
|
111
111
|
}
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
//
|
|
115
|
-
const Notification = mongoose.model("Notification", notificationSchema);
|
|
114
|
+
// Safe export to prevent OverwriteModelError
|
|
115
|
+
const Notification = mongoose.models.Notification || mongoose.model("Notification", notificationSchema);
|
|
116
116
|
export default Notification;
|
package/models/order.modal.js
CHANGED
|
@@ -277,9 +277,6 @@ payment: {
|
|
|
277
277
|
);
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
const Order = mongoose.model('Order', orderSchema);
|
|
281
|
-
export default Order;
|
|
282
|
-
|
|
283
280
|
|
|
284
|
-
|
|
285
|
-
|
|
281
|
+
const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
|
|
282
|
+
export default Order;
|
|
@@ -127,6 +127,6 @@ totalReviews: { type: Number, default: 0 }
|
|
|
127
127
|
// Optional: Ensure strict mode is not preventing fields if you intended flexibility (default is true)
|
|
128
128
|
// ProductListingSchema.set('strict', false); // Use with caution
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
export default ProductListing;
|
|
130
|
+
// Safe export to prevent OverwriteModelError
|
|
131
|
+
const ProductListing = mongoose.models.ProductListing || mongoose.model("productlistings", ProductListingSchema);
|
|
132
|
+
export default ProductListing;
|
|
@@ -39,7 +39,6 @@ profileInteractionSchema.index({ profile: 1, viewer: 1 }, {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
profileInteractionSchema.index({ viewedAt: -1 });
|
|
42
|
-
|
|
43
|
-
const ProfileInteraction = mongoose.model('ProfileInteraction', profileInteractionSchema);
|
|
44
|
-
|
|
45
|
-
export default ProfileInteraction;
|
|
42
|
+
// Safe export to prevent OverwriteModelError
|
|
43
|
+
const ProfileInteraction = mongoose.models.ProfileInteraction || mongoose.model('ProfileInteraction', profileInteractionSchema);
|
|
44
|
+
export default ProfileInteraction;
|
|
@@ -23,6 +23,7 @@ const registerShowSchema = new mongoose.Schema(
|
|
|
23
23
|
// Add compound index to prevent duplicate registrations
|
|
24
24
|
registerShowSchema.index({ showId: 1, userId: 1 }, { unique: true });
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// Safe export to prevent OverwriteModelError
|
|
27
|
+
const RegisterShow = mongoose.models.RegisterShow || mongoose.model("RegisterShow", registerShowSchema);
|
|
27
28
|
export default RegisterShow;
|
|
28
29
|
|
package/models/seller.model.js
CHANGED
|
@@ -294,6 +294,5 @@ const SellerSchema = new mongoose.Schema(
|
|
|
294
294
|
{ timestamps: true, strict: true }
|
|
295
295
|
);
|
|
296
296
|
|
|
297
|
-
const Seller = mongoose.model("sellers", SellerSchema);
|
|
298
|
-
|
|
299
|
-
export default Seller;
|
|
297
|
+
const Seller = mongoose.models.sellers || mongoose.model("sellers", SellerSchema);
|
|
298
|
+
export default Seller;
|
package/models/settings.model.js
CHANGED
package/models/shipper.model.js
CHANGED
|
@@ -122,7 +122,5 @@ const DropshipperSchema = new Schema(
|
|
|
122
122
|
// }
|
|
123
123
|
// next();
|
|
124
124
|
// });
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
export default Dropshipper;
|
|
125
|
+
const Dropshipper = mongoose.models.dropshippers || mongoose.model("dropshippers", DropshipperSchema);
|
|
126
|
+
export default Dropshipper;
|
|
@@ -172,6 +172,6 @@ ShoppableVideoSchema.index({ processingStatus: 1, updatedAt: 1 });
|
|
|
172
172
|
// Index for host and their videos
|
|
173
173
|
ShoppableVideoSchema.index({ host: 1, hostModel: 1 });
|
|
174
174
|
|
|
175
|
-
const ShoppableVideo = model("shoppablevideos", ShoppableVideoSchema);
|
|
175
|
+
const ShoppableVideo = mongoose.models.ShoppableVideo || mongoose.model("shoppablevideos", ShoppableVideoSchema);
|
|
176
176
|
|
|
177
|
-
export default ShoppableVideo;
|
|
177
|
+
export default ShoppableVideo;
|
|
@@ -54,5 +54,5 @@ ShoppableVideoCommentSchema.index({ parentCommentId: 1, createdAt: -1 });
|
|
|
54
54
|
ShoppableVideoCommentSchema.index({ userId: 1 });
|
|
55
55
|
ShoppableVideoCommentSchema.index({ videoId: 1, isReply: 1 });
|
|
56
56
|
|
|
57
|
-
const ShoppableVideoComment = mongoose.model("ShoppableVideoComment", ShoppableVideoCommentSchema);
|
|
58
|
-
export default ShoppableVideoComment;
|
|
57
|
+
const ShoppableVideoComment = mongoose.models.ShoppableVideoComment || mongoose.model("ShoppableVideoComment", ShoppableVideoCommentSchema);
|
|
58
|
+
export default ShoppableVideoComment;
|
|
@@ -25,6 +25,5 @@ shoppableVideoLikeSchema.index({ videoId: 1, userId: 1 }, { unique: true });
|
|
|
25
25
|
shoppableVideoLikeSchema.index({ videoId: 1, createdAt: -1 });
|
|
26
26
|
shoppableVideoLikeSchema.index({ userId: 1, createdAt: -1 });
|
|
27
27
|
|
|
28
|
-
const ShoppableVideoLike = mongoose.model("ShoppableVideoLike", shoppableVideoLikeSchema);
|
|
29
|
-
|
|
30
|
-
export default ShoppableVideoLike;
|
|
28
|
+
const ShoppableVideoLike = mongoose.models.ShoppableVideoLike || mongoose.model("ShoppableVideoLike", shoppableVideoLikeSchema);
|
|
29
|
+
export default ShoppableVideoLike;
|
|
@@ -23,6 +23,5 @@ const shoppableVideoSaveSchema = new mongoose.Schema(
|
|
|
23
23
|
// Add compound index to ensure a user can only save a video once
|
|
24
24
|
shoppableVideoSaveSchema.index({ videoId: 1, userId: 1 }, { unique: true });
|
|
25
25
|
|
|
26
|
-
const ShoppableVideoSave = mongoose.model("ShoppableVideoSave", shoppableVideoSaveSchema);
|
|
27
|
-
|
|
28
|
-
export default ShoppableVideoSave;
|
|
26
|
+
const ShoppableVideoSave = mongoose.models.ShoppableVideoSave || mongoose.model("ShoppableVideoSave", shoppableVideoSaveSchema);
|
|
27
|
+
export default ShoppableVideoSave;
|
package/models/shows.model.js
CHANGED
package/models/stock.model.js
CHANGED
|
@@ -36,8 +36,7 @@ const StockSchema = new Schema(
|
|
|
36
36
|
{ timestamps: true }
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
const Stock = model("stocks", StockSchema);
|
|
40
|
-
|
|
39
|
+
const Stock = mongoose.models.stocks || mongoose.model("stocks", StockSchema);
|
|
41
40
|
export default Stock;
|
|
42
41
|
|
|
43
42
|
|
|
@@ -123,6 +122,5 @@ export default Stock;
|
|
|
123
122
|
// StockSchema.set('toJSON', { virtuals: true });
|
|
124
123
|
// StockSchema.set('toObject', { virtuals: true });
|
|
125
124
|
|
|
126
|
-
// const Stock = model("stocks", StockSchema);
|
|
127
|
-
|
|
128
|
-
// export default Stock;
|
|
125
|
+
// const Stock = mongoose.models.stocks || mongoose.model("stocks", StockSchema);
|
|
126
|
+
// export default Stock;
|
package/models/ticket.model.js
CHANGED