flykup_model_development 3.1.74 → 3.1.76

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 (42) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/workflows/main.yml +30 -0
  3. package/.github/workflows/publish.yml +31 -0
  4. package/auth.js +14 -14
  5. package/config.js +1 -1
  6. package/db_connection.js +23 -23
  7. package/index.js +140 -140
  8. package/models/AadhaarVerification.js +131 -131
  9. package/models/AdminEmail.model.js +39 -38
  10. package/models/BankVerification.js +92 -92
  11. package/models/GSTVerification.js +89 -89
  12. package/models/LiveStreamInteraction.model.js +101 -101
  13. package/models/ProductInteraction.model.js +108 -108
  14. package/models/Review.model.js +121 -121
  15. package/models/SearchAnalytics.js +23 -23
  16. package/models/ShoppableInteraction.model.js +106 -106
  17. package/models/Wishlist.model.js +29 -29
  18. package/models/admin.model.js +42 -42
  19. package/models/appUpdate.model.js +19 -19
  20. package/models/assets.model.js +32 -32
  21. package/models/blockedRegion.models.js +27 -27
  22. package/models/chat.model.js +511 -511
  23. package/models/coHostInvitation.model.js +60 -60
  24. package/models/follow.model.js +38 -38
  25. package/models/loginlogs.model.js +26 -26
  26. package/models/notification.model.js +129 -129
  27. package/models/order.modal.js +386 -385
  28. package/models/orderPayment.model.js +218 -218
  29. package/models/productListing.model.js +322 -322
  30. package/models/profileInteractions.model.js +44 -44
  31. package/models/registerShow.model.js +29 -29
  32. package/models/sellerDraft.model.js +27 -27
  33. package/models/shipper.model.js +126 -126
  34. package/models/shoppableVideo.model.js +237 -237
  35. package/models/shoppableVideoComment.model.js +57 -57
  36. package/models/shoppableVideoLike.model.js +29 -29
  37. package/models/shoppableVideoSave.model.js +27 -27
  38. package/models/shows.model.js +604 -604
  39. package/models/stock.model.js +105 -105
  40. package/models/ticket.model.js +115 -115
  41. package/package.json +19 -19
  42. package/test.html +11 -11
@@ -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,129 @@
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
+ ],
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;