flykup_model_development 3.1.7 → 3.1.8
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,35 +1,53 @@
|
|
|
1
1
|
import mongoose, { Schema, model } from 'mongoose';
|
|
2
2
|
|
|
3
3
|
const productInteractionSchema = new mongoose.Schema({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
4
|
+
product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true },
|
|
5
|
+
user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', index: true },
|
|
6
|
+
seller: { type: mongoose.Schema.Types.ObjectId, ref: 'Seller', required: true },
|
|
7
|
+
location: {
|
|
8
|
+
city: String,
|
|
9
|
+
region: String,
|
|
10
|
+
country: String
|
|
11
|
+
},
|
|
12
|
+
platform: { type: String, enum: ['web', 'mobile', 'unknown'], default: 'mobile' },
|
|
13
|
+
device: { type: String, enum: ['mobile', 'desktop', 'tablet', 'other'] },
|
|
14
|
+
browser: String,
|
|
15
|
+
os: String,
|
|
16
|
+
ip: { type: String, required: true },
|
|
17
|
+
isIndianRegion: { type: Boolean, default: false },
|
|
18
|
+
rating: {
|
|
19
|
+
type: Number,
|
|
20
|
+
min: 1,
|
|
21
|
+
max: 5,
|
|
22
|
+
validate: {
|
|
23
|
+
validator: Number.isInteger,
|
|
24
|
+
message: '{VALUE} is not an integer value'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
review: {
|
|
28
|
+
type: String,
|
|
29
|
+
maxlength: 500
|
|
30
|
+
},
|
|
31
|
+
viewCount: { type: Number, default: 1 },
|
|
32
|
+
// NEW: Trust signals tracking
|
|
33
|
+
trustSignals: {
|
|
34
|
+
reviewViews: { type: Number, default: 0 }, // How many times user viewed reviews
|
|
35
|
+
reviewViewDuration: { type: Number, default: 0 }, // Total time spent on reviews (seconds)
|
|
36
|
+
comparisonViews: { type: Number, default: 0 }, // How many times user compared with other products
|
|
37
|
+
priceCheckCount: { type: Number, default: 0 }, // How many times user checked pricing
|
|
38
|
+
lastTrustSignalAt: { type: Date } // When the last trust signal was recorded
|
|
39
|
+
},
|
|
40
|
+
// NEW: Engagement status for sellers
|
|
41
|
+
engagementStatus: {
|
|
42
|
+
type: String,
|
|
43
|
+
enum: ['new', 'interested', 'hesitant', 'contacted', 'converted'],
|
|
44
|
+
default: 'new'
|
|
45
|
+
},
|
|
46
|
+
sellerNotes: [{
|
|
47
|
+
note: String,
|
|
48
|
+
createdAt: { type: Date, default: Date.now },
|
|
49
|
+
updatedAt: { type: Date, default: Date.now }
|
|
50
|
+
}]
|
|
33
51
|
}, { timestamps: true });
|
|
34
52
|
|
|
35
53
|
// Ensures a user's view is counted only once per product
|