flykup_model_production 1.0.1 → 1.0.3
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 +5 -2
- package/models/LiveStreamInteraction.model.js +5 -6
- package/models/ProductInteraction.model.js +4 -4
- package/models/Review.model.js +3 -3
- package/models/SearchAnalytics.js +4 -3
- package/models/ShoppableInteraction.model.js +3 -4
- package/models/Wishlist.model.js +2 -3
- package/models/admin.model.js +34 -20
- package/models/appUpdate.model.js +4 -2
- package/models/assets.model.js +3 -3
- package/models/blockedRegion.models.js +2 -2
- package/models/category.model.js +2 -2
- package/models/chat.model.js +7 -7
- package/models/coHostInvitation.model.js +3 -2
- package/models/follow.model.js +3 -2
- package/models/loginlogs.model.js +3 -2
- package/models/notification.model.js +5 -5
- package/models/order.modal.js +3 -6
- package/models/productListing.model.js +3 -3
- package/models/profileInteractions.model.js +4 -5
- package/models/registerShow.model.js +3 -2
- package/models/seller.model.js +2 -3
- package/models/settings.model.js +2 -3
- package/models/shipper.model.js +2 -4
- package/models/shoppableVideo.model.js +3 -3
- package/models/shoppableVideoComment.model.js +3 -4
- package/models/shoppableVideoLike.model.js +3 -4
- package/models/shoppableVideoSave.model.js +3 -4
- package/models/shows.model.js +2 -3
- package/models/stock.model.js +3 -5
- package/models/ticket.model.js +2 -2
- package/models/user.model.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema, model } from 'mongoose';
|
|
1
|
+
import mongoose, { Schema, model } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
const AdminEmailSchema = new Schema({
|
|
4
4
|
email: {
|
|
@@ -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;
|
|
@@ -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
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose from
|
|
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
|
-
|
|
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;
|
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.wishlists || mongoose.model("wishlists", WishlistSchema);
|
|
29
|
+
export default Wishlist;
|
package/models/admin.model.js
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
{
|
|
5
|
-
name: { type: String, required: true },
|
|
6
|
-
role: { type: String, required: true, default: "admin" },
|
|
7
|
-
email: { type: String, required: true, unique: true },
|
|
8
|
-
mobileNumber: { type: String, required: true },
|
|
9
|
-
password: { type: String, required: true },
|
|
10
|
-
profilePicture: { type: String, default: "https://img.freepik.com/free-vector/blue-circle-with-white-user_78370-4707.jpg" },
|
|
3
|
+
const { Schema } = mongoose;
|
|
11
4
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
const AdminSchema = new Schema(
|
|
6
|
+
{
|
|
7
|
+
name: { type: String, required: true },
|
|
8
|
+
role: { type: String, required: true, default: "admin" },
|
|
9
|
+
email: { type: String, required: true, unique: true },
|
|
10
|
+
mobileNumber: { type: String, required: true },
|
|
11
|
+
password: { type: String, required: true },
|
|
12
|
+
profilePicture: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "https://img.freepik.com/free-vector/blue-circle-with-white-user_78370-4707.jpg"
|
|
22
15
|
},
|
|
23
|
-
|
|
16
|
+
|
|
17
|
+
contentAccess: {
|
|
18
|
+
users: { readOnly: Boolean, edit: Boolean },
|
|
19
|
+
pendingSellers: { readOnly: Boolean, edit: Boolean },
|
|
20
|
+
sellers: { readOnly: Boolean, edit: Boolean },
|
|
21
|
+
orders: { readOnly: Boolean, edit: Boolean },
|
|
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 },
|
|
32
|
+
},
|
|
33
|
+
maskingSwitch: { type: Boolean, default: false },
|
|
34
|
+
},
|
|
35
|
+
{ timestamps: true }
|
|
24
36
|
);
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
// ✅ Fix: Use AdminSchema instead of Schema
|
|
39
|
+
const Admin = mongoose.models.Admin || mongoose.model("Admin", AdminSchema);
|
|
40
|
+
|
|
27
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
|
-
|
|
18
|
+
const Update = mongoose.models.Update || mongoose.model('Update', updateSchema);
|
|
19
|
+
|
|
20
|
+
export default Update;
|
package/models/assets.model.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/models/category.model.js
CHANGED
|
@@ -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;
|
package/models/chat.model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose from
|
|
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({
|
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Schema } from
|
|
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
|
-
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose from
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
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
|
@@ -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
|
-
|
|
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.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
|
|
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
|
-
|
|
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
|
@@ -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;
|
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;
|
|
@@ -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
|
|
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
|
|
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
|
|
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;
|
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
|
@@ -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;
|
package/models/user.model.js
CHANGED