flykup_model_production 1.0.16 → 1.0.18

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.
Files changed (40) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/workflows/publish.yml +31 -0
  3. package/auth.js +14 -14
  4. package/config.js +1 -1
  5. package/db_connection.js +23 -23
  6. package/index.js +140 -140
  7. package/models/AadhaarVerification.js +131 -131
  8. package/models/AdminEmail.model.js +38 -38
  9. package/models/BankVerification.js +92 -92
  10. package/models/GSTVerification.js +89 -89
  11. package/models/LiveStreamInteraction.model.js +101 -101
  12. package/models/ProductInteraction.model.js +108 -108
  13. package/models/Review.model.js +121 -121
  14. package/models/SearchAnalytics.js +23 -23
  15. package/models/ShoppableInteraction.model.js +106 -106
  16. package/models/Wishlist.model.js +29 -29
  17. package/models/admin.model.js +42 -42
  18. package/models/appUpdate.model.js +19 -19
  19. package/models/assets.model.js +32 -32
  20. package/models/blockedRegion.models.js +27 -27
  21. package/models/chat.model.js +511 -511
  22. package/models/coHostInvitation.model.js +60 -60
  23. package/models/follow.model.js +38 -38
  24. package/models/loginlogs.model.js +26 -26
  25. package/models/notification.model.js +130 -129
  26. package/models/order.modal.js +385 -385
  27. package/models/orderPayment.model.js +218 -218
  28. package/models/productListing.model.js +322 -322
  29. package/models/profileInteractions.model.js +44 -44
  30. package/models/registerShow.model.js +29 -29
  31. package/models/sellerDraft.model.js +27 -27
  32. package/models/shipper.model.js +126 -126
  33. package/models/shoppableVideo.model.js +237 -237
  34. package/models/shoppableVideoComment.model.js +57 -57
  35. package/models/shoppableVideoLike.model.js +29 -29
  36. package/models/shoppableVideoSave.model.js +27 -27
  37. package/models/shows.model.js +603 -603
  38. package/models/stock.model.js +105 -105
  39. package/models/ticket.model.js +115 -115
  40. package/package.json +18 -18
@@ -1,60 +1,60 @@
1
- import mongoose, { Schema } from "mongoose";
2
-
3
- const coHostInviteSchema = new Schema(
4
- {
5
- show: { type: Schema.Types.ObjectId, ref: "shows", required: true },
6
- host: {
7
- userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
8
- hostId: {
9
- type: mongoose.Schema.Types.ObjectId,
10
- required: true,
11
- refPath: "host.hostModel",
12
- },
13
- hostModel: {
14
- type: String,
15
- required: true,
16
- enum: {
17
- values: ["sellers", "dropshippers"],
18
- message: `{VALUE} is invalid host model`,
19
- },
20
- },
21
- },
22
-
23
-
24
- cohosts: [
25
- {
26
- userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
27
- hostId: {
28
- type: mongoose.Schema.Types.ObjectId,
29
- required: true,
30
- refPath: "cohosts.hostModel",
31
- },
32
- hostModel: {
33
- type: String,
34
- required: true,
35
- enum: {
36
- values: ["sellers", "dropshippers"],
37
- message: `{VALUE} is invalid cohost model`,
38
- },
39
- },
40
- status: {
41
- type: String,
42
- enum: ["pending", "accepted", "rejected", "cancelled", "left"],
43
- default: "pending",
44
- },
45
- joinedAt: Date,
46
- leftAt: Date,
47
- liveStreamId: String,
48
- },
49
- ],
50
- },
51
- { timestamps: true }
52
- );
53
-
54
- // Indexing for faster queries
55
- coHostInviteSchema.index({ show: 1, "cohosts.status": 1 });
56
- coHostInviteSchema.index({ "cohosts.userId": 1, "cohosts.status": 1 });
57
- // Safe export to prevent OverwriteModelError
58
- const CoHostInvite = mongoose.models.cohostinvites || mongoose.model("cohostinvites", coHostInviteSchema);
59
-
60
- export default CoHostInvite;
1
+ import mongoose, { Schema } from "mongoose";
2
+
3
+ const coHostInviteSchema = new Schema(
4
+ {
5
+ show: { type: Schema.Types.ObjectId, ref: "shows", required: true },
6
+ host: {
7
+ userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
8
+ hostId: {
9
+ type: mongoose.Schema.Types.ObjectId,
10
+ required: true,
11
+ refPath: "host.hostModel",
12
+ },
13
+ hostModel: {
14
+ type: String,
15
+ required: true,
16
+ enum: {
17
+ values: ["sellers", "dropshippers"],
18
+ message: `{VALUE} is invalid host model`,
19
+ },
20
+ },
21
+ },
22
+
23
+
24
+ cohosts: [
25
+ {
26
+ userId: { type: Schema.Types.ObjectId, ref: "users", required: true },
27
+ hostId: {
28
+ type: mongoose.Schema.Types.ObjectId,
29
+ required: true,
30
+ refPath: "cohosts.hostModel",
31
+ },
32
+ hostModel: {
33
+ type: String,
34
+ required: true,
35
+ enum: {
36
+ values: ["sellers", "dropshippers"],
37
+ message: `{VALUE} is invalid cohost model`,
38
+ },
39
+ },
40
+ status: {
41
+ type: String,
42
+ enum: ["pending", "accepted", "rejected", "cancelled", "left"],
43
+ default: "pending",
44
+ },
45
+ joinedAt: Date,
46
+ leftAt: Date,
47
+ liveStreamId: String,
48
+ },
49
+ ],
50
+ },
51
+ { timestamps: true }
52
+ );
53
+
54
+ // Indexing for faster queries
55
+ coHostInviteSchema.index({ show: 1, "cohosts.status": 1 });
56
+ coHostInviteSchema.index({ "cohosts.userId": 1, "cohosts.status": 1 });
57
+ // Safe export to prevent OverwriteModelError
58
+ const CoHostInvite = mongoose.models.cohostinvites || mongoose.model("cohostinvites", coHostInviteSchema);
59
+
60
+ export default CoHostInvite;
@@ -1,38 +1,38 @@
1
- import mongoose, { Schema, model } from 'mongoose';
2
-
3
- const FollowSchema = new mongoose.Schema(
4
- {
5
- follower: {
6
- type: mongoose.Schema.Types.ObjectId,
7
- ref: "users",
8
- required: true,
9
- },
10
- following: {
11
- type: mongoose.Schema.Types.ObjectId,
12
- ref: "users",
13
- required: true,
14
- },
15
- },
16
- { timestamps: true }
17
- );
18
-
19
- // Prevent duplicate follows
20
- FollowSchema.index({ follower: 1, following: 1 }, { unique: true });
21
-
22
- // Add helpful indexes for efficient querying
23
- FollowSchema.index({ follower: 1 });
24
- FollowSchema.index({ following: 1 });
25
-
26
- FollowSchema.pre('save', function(next) {
27
- if (this.follower.equals(this.following)) {
28
- const err = new Error("Cannot follow yourself");
29
- next(err);
30
- } else {
31
- next();
32
- }
33
- });
34
-
35
- // Safe export to prevent OverwriteModelError
36
- const Follow = mongoose.models.follows || mongoose.model("follows", FollowSchema);
37
-
38
- export default Follow;
1
+ import mongoose, { Schema, model } from 'mongoose';
2
+
3
+ const FollowSchema = new mongoose.Schema(
4
+ {
5
+ follower: {
6
+ type: mongoose.Schema.Types.ObjectId,
7
+ ref: "users",
8
+ required: true,
9
+ },
10
+ following: {
11
+ type: mongoose.Schema.Types.ObjectId,
12
+ ref: "users",
13
+ required: true,
14
+ },
15
+ },
16
+ { timestamps: true }
17
+ );
18
+
19
+ // Prevent duplicate follows
20
+ // FollowSchema.index({ follower: 1, following: 1 }, { unique: true });
21
+
22
+ // // Add helpful indexes for efficient querying
23
+ // FollowSchema.index({ follower: 1 });
24
+ // FollowSchema.index({ following: 1 });
25
+
26
+ FollowSchema.pre('save', function(next) {
27
+ if (this.follower.equals(this.following)) {
28
+ const err = new Error("Cannot follow yourself");
29
+ next(err);
30
+ } else {
31
+ next();
32
+ }
33
+ });
34
+
35
+ // Safe export to prevent OverwriteModelError
36
+ const Follow = mongoose.models.follows || mongoose.model("follows", FollowSchema);
37
+
38
+ export default Follow;
@@ -1,26 +1,26 @@
1
- import mongoose, { Schema, model } from 'mongoose';
2
-
3
- const loginLogSchema = new mongoose.Schema({
4
- userId: {
5
- type: mongoose.Schema.Types.ObjectId,
6
- ref: "users",
7
- required: true,
8
- },
9
- ip: { type: String, required: true },
10
- country: String,
11
- region: String,
12
- city: String,
13
- location: String,
14
- device: Object,
15
- browser: Object,
16
- os: Object,
17
- loginType: String,
18
- status: { type: String, enum: ['active', 'loggedOut'], default: 'active' }, // 🔥 new field
19
- lastActivity: { type: Date, default: Date.now }, // 🔥 to track token refresh or other actions
20
- time: { type: Date, default: Date.now }
21
- }, { timestamps: true });
22
-
23
- // Safe export to prevent OverwriteModelError
24
- const LoginLog = mongoose.models.LoginLog || mongoose.model('LoginLog', loginLogSchema);
25
-
26
- export default LoginLog;
1
+ import mongoose, { Schema, model } from 'mongoose';
2
+
3
+ const loginLogSchema = new mongoose.Schema({
4
+ userId: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: "users",
7
+ required: true,
8
+ },
9
+ ip: { type: String, required: true },
10
+ country: String,
11
+ region: String,
12
+ city: String,
13
+ location: String,
14
+ device: Object,
15
+ browser: Object,
16
+ os: Object,
17
+ loginType: String,
18
+ status: { type: String, enum: ['active', 'loggedOut'], default: 'active' }, // 🔥 new field
19
+ lastActivity: { type: Date, default: Date.now }, // 🔥 to track token refresh or other actions
20
+ time: { type: Date, default: Date.now }
21
+ }, { timestamps: true });
22
+
23
+ // Safe export to prevent OverwriteModelError
24
+ const LoginLog = mongoose.models.LoginLog || mongoose.model('LoginLog', loginLogSchema);
25
+
26
+ export default LoginLog;
@@ -1,129 +1,130 @@
1
- import mongoose, { Schema, model } from 'mongoose';
2
-
3
- const notificationSchema = new mongoose.Schema(
4
- {
5
- type: {
6
- type: String,
7
- enum: [
8
- "mention",
9
- "request",
10
- "follow",
11
- "approval",
12
- "seller_status",
13
- "order_placed",
14
- "order_status",
15
- "order_cancelled",
16
- "return_requested",
17
- "return_status",
18
- 'new_video',
19
- "new_product",
20
- 'admin_broadcast',
21
- 'seller_broadcast',
22
- 'live_stream_start',
23
- 'seller_order_update',
24
- 'new_show_scheduled',
25
- 'cohost_invite',
26
- 'cohost_accepted',
27
- 'cohost_rejected',
28
- 'cohost_join_live'
29
- ],
30
- required: true,
31
- },
32
- message: {
33
- type: String,
34
- required: true,
35
- },
36
- title: {
37
- type: String,
38
- required: true,
39
- default: "New Notification",
40
- },
41
- body: {
42
- type: String,
43
- required: true,
44
- },
45
- url: {
46
- type: String,
47
- default: "/notifications",
48
- },
49
- icon: {
50
- type: String,
51
- default:
52
- "https://d2jp9e7w3mhbvf.cloudfront.net/products/bd654f06-fe3b-4417-b995-2a31a3b25ae2_Logo-Flykup.png",
53
- },
54
- image: {
55
- type: String,
56
- default: null,
57
- },
58
- cutMessage: {
59
- type: String,
60
- },
61
- fromUser: {
62
- type: mongoose.Schema.Types.ObjectId,
63
- ref: "users",
64
- },
65
- fromSystem: {
66
- type: String, // e.g., "Flykup Team"
67
- default: null,
68
- },
69
-
70
- toUser: {
71
- type: mongoose.Schema.Types.ObjectId,
72
- ref: "users",
73
- required: true,
74
- },
75
- link: {
76
- type: String,
77
- default: null,
78
- },
79
- file: {
80
- name: String,
81
- size: String,
82
- },
83
- actions: {
84
- type: [String], // e.g., ["Accept", "Decline"]
85
- default: [],
86
- },
87
- isRead: {
88
- type: Boolean,
89
- default: false,
90
- },
91
- senderProfile: {
92
- userId: {
93
- type: mongoose.Schema.Types.ObjectId,
94
- ref: "users",
95
- },
96
- userName: {
97
- type: String,
98
- },
99
- profileURL: {
100
- // This is where the profile URL from populated sender will go
101
- type: String, // Just a string now
102
- default: null,
103
- },
104
- role: {
105
- type: String,
106
- },
107
- },
108
- // metadata: {
109
- // status: String,
110
- // reason: String,
111
- // orderId: mongoose.Schema.Types.ObjectId,
112
- // requestId: mongoose.Schema.Types.ObjectId,
113
- // customerName: String,
114
- // sellerName: String,
115
- // customerProfileURL: String,
116
- // },
117
- metadata: {
118
- type: mongoose.Schema.Types.Mixed, // This allows any JSON object
119
- default: {} // Default to empty object
120
- },
121
- },
122
- {
123
- timestamps: true,
124
- }
125
- );
126
-
127
- // Safe export to prevent OverwriteModelError
128
- const Notification = mongoose.models.Notification || mongoose.model("Notification", notificationSchema);
129
- export default Notification;
1
+ import mongoose, { Schema, model } from 'mongoose';
2
+
3
+ const notificationSchema = new mongoose.Schema(
4
+ {
5
+ type: {
6
+ type: String,
7
+ enum: [
8
+ "mention",
9
+ "request",
10
+ "follow",
11
+ "approval",
12
+ "seller_status",
13
+ "order_placed",
14
+ "order_status",
15
+ "order_cancelled",
16
+ "return_requested",
17
+ "return_status",
18
+ 'new_video',
19
+ "new_product",
20
+ 'admin_broadcast',
21
+ 'seller_broadcast',
22
+ 'live_stream_start',
23
+ 'seller_order_update',
24
+ 'new_show_scheduled',
25
+ 'cohost_invite',
26
+ 'cohost_accepted',
27
+ 'cohost_rejected',
28
+ 'cohost_join_live',
29
+ 'flash_sale_started'
30
+ ],
31
+ required: true,
32
+ },
33
+ message: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ title: {
38
+ type: String,
39
+ required: true,
40
+ default: "New Notification",
41
+ },
42
+ body: {
43
+ type: String,
44
+ required: true,
45
+ },
46
+ url: {
47
+ type: String,
48
+ default: "/notifications",
49
+ },
50
+ icon: {
51
+ type: String,
52
+ default:
53
+ "https://d2jp9e7w3mhbvf.cloudfront.net/products/bd654f06-fe3b-4417-b995-2a31a3b25ae2_Logo-Flykup.png",
54
+ },
55
+ image: {
56
+ type: String,
57
+ default: null,
58
+ },
59
+ cutMessage: {
60
+ type: String,
61
+ },
62
+ fromUser: {
63
+ type: mongoose.Schema.Types.ObjectId,
64
+ ref: "users",
65
+ },
66
+ fromSystem: {
67
+ type: String, // e.g., "Flykup Team"
68
+ default: null,
69
+ },
70
+
71
+ toUser: {
72
+ type: mongoose.Schema.Types.ObjectId,
73
+ ref: "users",
74
+ required: true,
75
+ },
76
+ link: {
77
+ type: String,
78
+ default: null,
79
+ },
80
+ file: {
81
+ name: String,
82
+ size: String,
83
+ },
84
+ actions: {
85
+ type: [String], // e.g., ["Accept", "Decline"]
86
+ default: [],
87
+ },
88
+ isRead: {
89
+ type: Boolean,
90
+ default: false,
91
+ },
92
+ senderProfile: {
93
+ userId: {
94
+ type: mongoose.Schema.Types.ObjectId,
95
+ ref: "users",
96
+ },
97
+ userName: {
98
+ type: String,
99
+ },
100
+ profileURL: {
101
+ // This is where the profile URL from populated sender will go
102
+ type: String, // Just a string now
103
+ default: null,
104
+ },
105
+ role: {
106
+ type: String,
107
+ },
108
+ },
109
+ // metadata: {
110
+ // status: String,
111
+ // reason: String,
112
+ // orderId: mongoose.Schema.Types.ObjectId,
113
+ // requestId: mongoose.Schema.Types.ObjectId,
114
+ // customerName: String,
115
+ // sellerName: String,
116
+ // customerProfileURL: String,
117
+ // },
118
+ metadata: {
119
+ type: mongoose.Schema.Types.Mixed, // This allows any JSON object
120
+ default: {} // Default to empty object
121
+ },
122
+ },
123
+ {
124
+ timestamps: true,
125
+ }
126
+ );
127
+
128
+ // Safe export to prevent OverwriteModelError
129
+ const Notification = mongoose.models.Notification || mongoose.model("Notification", notificationSchema);
130
+ export default Notification;