flykup_model_development 1.0.0 → 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.
@@ -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
- export default model('AdminEmail', AdminEmailSchema);
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
- const LiveStreamInteraction = mongoose.model(
89
- 'LiveStreamInteraction',
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
- const ProductInteraction = mongoose.model('ProductInteraction', productInteractionSchema);
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;
@@ -116,6 +116,6 @@ ReviewSchema.methods.getUserVoteType = function(userId) {
116
116
  return vote ? vote.voteType : null;
117
117
  };
118
118
 
119
- const Review = mongoose.model("reviews", ReviewSchema);
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
- export default mongoose.model("SearchAnalytics", searchAnalyticsSchema);
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;
@@ -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;
@@ -22,6 +22,6 @@ const AdminSchema = new mongoose.Schema(
22
22
  },
23
23
  { timestamps: true }
24
24
  );
25
+ const Admin = mongoose.models.Admin || mongoose.model("Admin", schema);
25
26
 
26
- const Admin = mongoose.model('Admin', AdminSchema);
27
27
  export default Admin;
@@ -15,4 +15,6 @@ const updateSchema = new Schema({
15
15
  createdAt: { type: Date, default: Date.now }
16
16
  });
17
17
 
18
- export default model('Update', updateSchema);
18
+ const Update = mongoose.models.Update || mongoose.model('Update', updateSchema);
19
+
20
+ export default Update;
@@ -28,5 +28,4 @@ const assetSchema = new mongoose.Schema({
28
28
 
29
29
  assetSchema.plugin(mongoosePaginate);
30
30
 
31
- // Changed to a named export 'AssetsModel'
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;
@@ -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;
@@ -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
- const CoHostInvite = mongoose.model("cohostinvites", coHostInviteSchema);
54
+ // Safe export to prevent OverwriteModelError
55
+ const CoHostInvite = mongoose.models.cohostinvites || mongoose.model("cohostinvites", coHostInviteSchema);
55
56
 
56
57
  export default CoHostInvite;
@@ -32,6 +32,7 @@ FollowSchema.pre('save', function(next) {
32
32
  }
33
33
  });
34
34
 
35
- const Follow = mongoose.model("follows", FollowSchema);
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
- const LoginLog = mongoose.model('LoginLog', loginLogSchema);
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
- // Define and then export, or directly export the model
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;
@@ -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
- // const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
285
- // export default Order;
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
- const ProductListing = mongoose.model("productlistings", ProductListingSchema);
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
- const RegisterShow = mongoose.model("RegisterShow", registerShowSchema);
26
+ // Safe export to prevent OverwriteModelError
27
+ const RegisterShow = mongoose.models.RegisterShow || mongoose.model("RegisterShow", registerShowSchema);
27
28
  export default RegisterShow;
28
29
 
@@ -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;
@@ -13,6 +13,5 @@ const SettingsSchema = new mongoose.Schema({
13
13
  }
14
14
  });
15
15
 
16
- const Settings = mongoose.model('Settings', SettingsSchema);
17
-
16
+ const Settings = mongoose.models.Settings || mongoose.model('Settings', SettingsSchema);
18
17
  export default Settings;
@@ -122,7 +122,5 @@ const DropshipperSchema = new Schema(
122
122
  // }
123
123
  // next();
124
124
  // });
125
-
126
- const Dropshipper = mongoose.model("dropshippers", DropshipperSchema);
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;
@@ -310,6 +310,5 @@ showSchema.pre('save', function (next) {
310
310
  next();
311
311
  });
312
312
 
313
- const Show = mongoose.model("shows", showSchema);
314
-
315
- export default Show;
313
+ const Show = mongoose.models.shows || mongoose.model("shows", showSchema);
314
+ export default Show;
@@ -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;
@@ -111,5 +111,5 @@ const ticketSchema = new mongoose.Schema(
111
111
  { timestamps: true }
112
112
  );
113
113
 
114
- const Ticket = mongoose.model('Ticket', ticketSchema);
114
+ const Ticket = mongoose.models.Ticket || mongoose.model('Ticket', ticketSchema);
115
115
  export default Ticket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,