flykup_model_production 1.0.2 → 1.0.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.
@@ -1,42 +1,39 @@
1
- import { Schema, models, model } from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
- const AdminEmailSchema = new Schema(
4
- {
5
- email: {
6
- type: String,
7
- required: true,
8
- unique: true,
9
- lowercase: true,
10
- trim: true,
11
- },
12
- isActive: {
3
+ const AdminEmailSchema = new Schema({
4
+ email: {
5
+ type: String,
6
+ required: true,
7
+ unique: true,
8
+ lowercase: true,
9
+ trim: true
10
+ },
11
+ isActive: {
12
+ type: Boolean,
13
+ default: true
14
+ },
15
+ permissions: {
16
+ shoppableVideo: {
13
17
  type: Boolean,
14
- default: true,
18
+ default: false
15
19
  },
16
- permissions: {
17
- shoppableVideo: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- productAccess: {
22
- type: Boolean,
23
- default: false,
24
- },
25
- totalAccess: {
26
- type: Boolean,
27
- default: false,
28
- },
20
+ productAccess: {
21
+ type: Boolean,
22
+ default: false
29
23
  },
30
- },
31
- {
32
- timestamps: true,
24
+ totalAccess: {
25
+ type: Boolean,
26
+ default: false
27
+ }
33
28
  }
34
- );
29
+ }, {
30
+ timestamps: true
31
+ });
35
32
 
36
33
  // Index for faster querying
37
34
  AdminEmailSchema.index({ email: 1, isActive: 1 });
38
35
 
39
- // Use existing model if already compiled
40
- const AdminEmail = models.AdminEmail || model('AdminEmail', AdminEmailSchema);
36
+ // Export safely
37
+ const AdminEmail = mongoose.models.AdminEmail || mongoose.model('AdminEmail', AdminEmailSchema);
41
38
 
42
- export default AdminEmail;
39
+ export default AdminEmail;
@@ -1,4 +1,5 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
+
2
3
  import crypto from 'crypto';
3
4
 
4
5
  const liveStreamInteractionSchema = new mongoose.Schema({
@@ -85,9 +86,7 @@ liveStreamInteractionSchema.index({ show: 1, sessionIdentifier: 1 }, {
85
86
 
86
87
  liveStreamInteractionSchema.index({ show: 1, createdAt: -1 });
87
88
 
88
- const LiveStreamInteraction = mongoose.model(
89
- 'LiveStreamInteraction',
90
- liveStreamInteractionSchema
91
- );
89
+ // Safe export to prevent OverwriteModelError
90
+ const LiveStreamInteraction = mongoose.models.LiveStreamInteraction || mongoose.model('LiveStreamInteraction', liveStreamInteractionSchema);
92
91
 
93
- export default LiveStreamInteraction;
92
+ export default LiveStreamInteraction;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const productInteractionSchema = new mongoose.Schema({
4
4
  product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true },
@@ -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 };
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const searchAnalyticsSchema = new mongoose.Schema({
4
4
  searchTerm: { type: String, required: true, trim: true },
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
  import crypto from 'crypto';
3
3
 
4
4
  const shoppableVideoInteractionSchema = new mongoose.Schema({
@@ -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.wishlists || mongoose.model("wishlists", WishlistSchema);
29
+ export default Wishlist;
@@ -1,6 +1,8 @@
1
- import mongoose from "mongoose";
1
+ import mongoose from 'mongoose';
2
2
 
3
- const AdminSchema = new mongoose.Schema(
3
+ const { Schema } = mongoose;
4
+
5
+ const AdminSchema = new Schema(
4
6
  {
5
7
  name: { type: String, required: true },
6
8
  role: { type: String, required: true, default: "admin" },
@@ -9,23 +11,31 @@ const AdminSchema = new mongoose.Schema(
9
11
  password: { type: String, required: true },
10
12
  profilePicture: {
11
13
  type: String,
12
- default:
13
- "https://img.freepik.com/free-vector/blue-circle-with-white-user_78370-4707.jpg",
14
+ default: "https://img.freepik.com/free-vector/blue-circle-with-white-user_78370-4707.jpg"
14
15
  },
16
+
15
17
  contentAccess: {
16
18
  users: { readOnly: Boolean, edit: Boolean },
17
19
  pendingSellers: { readOnly: Boolean, edit: Boolean },
18
20
  sellers: { readOnly: Boolean, edit: Boolean },
19
21
  orders: { readOnly: Boolean, edit: Boolean },
20
22
  category: { readOnly: Boolean, edit: Boolean },
23
+ autoApproved:{readOnly:Boolean,edit:Boolean},
24
+ manualReview:{readOnly:Boolean,edit:Boolean},
25
+ AutoRejected:{readOnly:Boolean,edit:Boolean},
26
+ NewSellers:{readOnly:Boolean,edit:Boolean},
27
+ Coupons:{readOnly:Boolean,edit:Boolean},
28
+ Plans:{readOnly:Boolean,edit:Boolean},
29
+ orderPayments:{readOnly:Boolean,edit:Boolean},
30
+ // settings: { readOnly: Boolean, edit: Boolean },
31
+ // admins: { readOnly: Boolean, edit: Boolean },
21
32
  },
22
33
  maskingSwitch: { type: Boolean, default: false },
23
34
  },
24
35
  { timestamps: true }
25
36
  );
26
37
 
27
- // ✅ Guard against recompile
28
- const Admin =
29
- mongoose.models.Admin || mongoose.model("Admin", AdminSchema);
38
+ // ✅ Fix: Use AdminSchema instead of Schema
39
+ const Admin = mongoose.models.Admin || mongoose.model("Admin", AdminSchema);
30
40
 
31
41
  export default Admin;
@@ -1,4 +1,4 @@
1
- import { Schema, model } from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const updateSchema = new Schema({
4
4
  platform: { type: String, enum: ['android', 'ios'], required: true },
@@ -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;
@@ -1,6 +1,7 @@
1
1
  // models/Asset.js
2
2
 
3
- import mongoose from 'mongoose';
3
+ import mongoose, { Schema, model } from 'mongoose';
4
+
4
5
  import mongoosePaginate from 'mongoose-paginate-v2';
5
6
 
6
7
  const assetSchema = new mongoose.Schema({
@@ -28,5 +29,4 @@ const assetSchema = new mongoose.Schema({
28
29
 
29
30
  assetSchema.plugin(mongoosePaginate);
30
31
 
31
- // Changed to a named export 'AssetsModel'
32
- export const AssetsModel = mongoose.model('Asset', assetSchema);
32
+ export const AssetsModel = mongoose.models.Asset || mongoose.model('Asset', assetSchema);
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const blockedRegionSchema = new mongoose.Schema({
4
4
  region: {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const SubcategorySchema = new mongoose.Schema({
4
4
  name: {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  // Chat Room Schema - Handles different types of conversations
4
4
  const ChatRoomSchema = new mongoose.Schema({
@@ -65,6 +65,14 @@ const ChatRoomSchema = new mongoose.Schema({
65
65
  type: Date,
66
66
  default: null
67
67
  },
68
+ isMuted: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ mutedAt: {
73
+ type: Date,
74
+ default:null
75
+ },
68
76
  isPinned: { type: Boolean, default: false }, // Add this field
69
77
  pinnedAt: Date, // Add this field
70
78
  }],
@@ -487,10 +495,10 @@ ChatRoomMemberSchema.index({ userId: 1, status: 1 });
487
495
 
488
496
  ChatBlockSchema.index({ blockerId: 1, blockedUserId: 1 });
489
497
 
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);
498
+ // Models with safe exports to prevent OverwriteModelError
499
+ const ChatRoom = mongoose.models.chatrooms || mongoose.model('chatrooms', ChatRoomSchema);
500
+ const ChatMessage = mongoose.models.chatmessages || mongoose.model('chatmessages', ChatMessageSchema);
501
+ const ChatRoomMember = mongoose.models.chatroommembers || mongoose.model('chatroommembers', ChatRoomMemberSchema);
502
+ const ChatBlock = mongoose.models.chatblocks || mongoose.model('chatblocks', ChatBlockSchema);
495
503
 
496
- export { ChatRoom, ChatMessage, ChatRoomMember, ChatBlock };
504
+ export { ChatRoom, ChatMessage, ChatRoomMember, ChatBlock };
@@ -1,4 +1,4 @@
1
- import mongoose, { Schema } from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const coHostInviteSchema = new Schema(
4
4
  {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const FollowSchema = new mongoose.Schema(
4
4
  {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const loginLogSchema = new mongoose.Schema({
4
4
  userId: {
@@ -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;
@@ -1,6 +1,4 @@
1
- import mongoose from "mongoose";
2
- // Clear cached model to ensure latest schema is used
3
- delete mongoose.connection.models.Notification;
1
+ import mongoose, { Schema, model } from 'mongoose';
4
2
 
5
3
  const notificationSchema = new mongoose.Schema(
6
4
  {
@@ -17,6 +15,8 @@ const notificationSchema = new mongoose.Schema(
17
15
  "order_cancelled",
18
16
  "return_requested",
19
17
  "return_status",
18
+ 'new_video',
19
+ "new_product",
20
20
  ],
21
21
  required: true,
22
22
  },
@@ -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;
@@ -1,5 +1,5 @@
1
1
  // order.modal.js
2
- import mongoose from 'mongoose';
2
+ import mongoose, { Schema, model } from 'mongoose';
3
3
  import { nanoid } from 'nanoid';
4
4
 
5
5
  const orderSchema = new mongoose.Schema(
@@ -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.productlistings || mongoose.model("productlistings", ProductListingSchema);
132
+ export default ProductListing;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const profileInteractionSchema = new mongoose.Schema({
4
4
  profile: {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const registerShowSchema = new mongoose.Schema(
4
4
  {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from 'mongoose';
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const SettingsSchema = new mongoose.Schema({
4
4
  appSettings: {
@@ -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;
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- import { Schema, model } from "mongoose";
3
+ import mongoose, { Schema, model } from "mongoose";
4
4
 
5
5
 
6
6
 
@@ -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.shoppablevideos || mongoose.model("shoppablevideos", ShoppableVideoSchema);
176
176
 
177
- export default ShoppableVideo;
177
+ export default ShoppableVideo;
@@ -1,5 +1,4 @@
1
- import mongoose from "mongoose";
2
-
1
+ import mongoose, { Schema, model } from 'mongoose';
3
2
 
4
3
  const ShoppableVideoCommentSchema = new mongoose.Schema({
5
4
  videoId: {
@@ -54,5 +53,5 @@ ShoppableVideoCommentSchema.index({ parentCommentId: 1, createdAt: -1 });
54
53
  ShoppableVideoCommentSchema.index({ userId: 1 });
55
54
  ShoppableVideoCommentSchema.index({ videoId: 1, isReply: 1 });
56
55
 
57
- const ShoppableVideoComment = mongoose.model("ShoppableVideoComment", ShoppableVideoCommentSchema);
58
- export default ShoppableVideoComment;
56
+ const ShoppableVideoComment = mongoose.models.ShoppableVideoComment || mongoose.model("ShoppableVideoComment", ShoppableVideoCommentSchema);
57
+ export default ShoppableVideoComment;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const shoppableVideoLikeSchema = new mongoose.Schema(
4
4
  {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
 
3
3
  const shoppableVideoSaveSchema = new mongoose.Schema(
4
4
  {
@@ -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;
@@ -1,5 +1,5 @@
1
1
  // models/Ticket.js
2
- import mongoose from 'mongoose';
2
+ import mongoose, { Schema, model } from 'mongoose';
3
3
 
4
4
  const replySchema = new mongoose.Schema({
5
5
  message: {
@@ -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;
@@ -1,4 +1,4 @@
1
- import mongoose from "mongoose";
1
+ import mongoose, { Schema, model } from 'mongoose';
2
2
  import bcrypt from "bcrypt";
3
3
  import jwt from "jsonwebtoken";
4
4
  import Seller from "./seller.model.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_production",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,