Initial commit

This commit is contained in:
payacom
2026-07-09 15:25:16 +03:30
parent 0b01b262fa
commit 51eb7d0224
21 changed files with 1544 additions and 98 deletions

View File

@@ -0,0 +1,54 @@
const mongoose = require('mongoose')
const timestamp = require('mongoose-timestamp')
const exploreInteractionSchema = new mongoose.Schema({
viewerId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
index: true
},
targetType: {
type: String,
enum: ['post', 'profile', 'academy'],
required: true
},
targetId: {
type: mongoose.Schema.Types.ObjectId,
required: true
},
authorId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
default: null
},
contentType: {
type: String,
enum: ['image', 'video', 'academy'],
default: 'image'
},
action: {
type: String,
enum: [
'view',
'profile_visit',
'share',
'like',
'comment',
'offer',
'watch_complete',
'skip',
'dwell'
],
default: 'view'
},
dwellMs: {
type: Number,
default: null
}
})
exploreInteractionSchema.index({ viewerId: 1, createdAt: -1 })
exploreInteractionSchema.plugin(timestamp)
module.exports = mongoose.model('ExploreInteraction', exploreInteractionSchema)