full app
This commit is contained in:
28
models/ShareableLinkModel.js
Normal file
28
models/ShareableLinkModel.js
Normal 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
|
||||
Reference in New Issue
Block a user