This commit is contained in:
payacom
2026-08-31 20:45:41 +03:30
parent fa9f23c61d
commit 3f416a7a60
367 changed files with 621895 additions and 6443 deletions

View File

@@ -0,0 +1,29 @@
const mongoose = require('mongoose')
// جلوگیری از نوتیف تکراری برای یک کاربر درباره‌ی یک پست خاص — سبک و موقت (۳۰ روز TTL)،
// شبیه نقشی که ExploreInteractionModel برای ردیابی سبک بازی می‌کنه
const smartNotificationLogSchema = new mongoose.Schema({
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
post_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Post',
required: true
},
type: {
type: String,
required: true
},
createdAt: {
type: Date,
default: Date.now,
expires: 60 * 60 * 24 * 30 // ۳۰ روز
}
})
smartNotificationLogSchema.index({ user_id: 1, post_id: 1, type: 1 }, { unique: true })
module.exports = mongoose.model('SmartNotificationLog', smartNotificationLogSchema)