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.
- package/.gitattributes +2 -0
- package/.github/workflows/publish.yml +31 -0
- package/auth.js +14 -14
- package/config.js +1 -1
- package/db_connection.js +23 -23
- package/index.js +140 -140
- package/models/AadhaarVerification.js +131 -131
- package/models/AdminEmail.model.js +38 -38
- package/models/BankVerification.js +92 -92
- package/models/GSTVerification.js +89 -89
- package/models/LiveStreamInteraction.model.js +101 -101
- package/models/ProductInteraction.model.js +108 -108
- package/models/Review.model.js +121 -121
- package/models/SearchAnalytics.js +23 -23
- package/models/ShoppableInteraction.model.js +106 -106
- package/models/Wishlist.model.js +29 -29
- package/models/admin.model.js +42 -42
- package/models/appUpdate.model.js +19 -19
- package/models/assets.model.js +32 -32
- package/models/blockedRegion.models.js +27 -27
- package/models/chat.model.js +511 -511
- package/models/coHostInvitation.model.js +60 -60
- package/models/follow.model.js +38 -38
- package/models/loginlogs.model.js +26 -26
- package/models/notification.model.js +130 -129
- package/models/order.modal.js +385 -385
- package/models/orderPayment.model.js +218 -218
- package/models/productListing.model.js +322 -322
- package/models/profileInteractions.model.js +44 -44
- package/models/registerShow.model.js +29 -29
- package/models/sellerDraft.model.js +27 -27
- package/models/shipper.model.js +126 -126
- package/models/shoppableVideo.model.js +237 -237
- package/models/shoppableVideoComment.model.js +57 -57
- package/models/shoppableVideoLike.model.js +29 -29
- package/models/shoppableVideoSave.model.js +27 -27
- package/models/shows.model.js +603 -603
- package/models/stock.model.js +105 -105
- package/models/ticket.model.js +115 -115
- 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;
|
package/models/follow.model.js
CHANGED
|
@@ -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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
+
'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;
|