This commit is contained in:
payacom
2026-09-24 21:03:27 +03:30
parent 7f0ddfde70
commit 806471241e
43 changed files with 2166 additions and 144 deletions

View File

@@ -0,0 +1,28 @@
const mongoose = require('mongoose')
const timestamp = require('mongoose-timestamp')
// اشتراک‌گذاری لینک: کاربر مشخص می‌کنه کدوم محتوای خودش (پکیج/پروژه/بیلبورد/فروشگاه/
// کالا/رزرو) وقتی یکی دیگه توی ثبت پست تگش می‌کنه، توی لیست لینک‌های قابل‌انتخاب اون
// کاربر (بلاگر) نشون داده بشه — shareableLinksController.js/for-users همین رکوردها رو می‌خونه
const shareableLinkSchema = new mongoose.Schema({
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
kind: {
type: String,
enum: ['pkg', 'project', 'billboard', 'shop', 'shopproduct', 'booking'],
required: true
},
ref_id: {
type: String,
required: true
}
})
shareableLinkSchema.index({ user_id: 1, kind: 1, ref_id: 1 }, { unique: true })
shareableLinkSchema.plugin(timestamp)
const ShareableLinkModel = mongoose.model('ShareableLink', shareableLinkSchema)
module.exports = ShareableLinkModel