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

@@ -1,8 +1,11 @@
const mongoose = require('mongoose')
const timestamp = require('mongoose-timestamp')
// متن‌های روی استوری با مختصات نسبی (۰ تا ۱) تا در هر ابعادی درست رندر شوند
// متن‌ها و لینک‌های روی استوری با مختصات نسبی (۰ تا ۱) تا در هر ابعادی درست رندر شوند —
// type مشخص می‌کنه اورلی متنیه یا لینکِ یکی از موارد قابل‌لینک (پکیج/پروژه/بیلبورد/فروشگاه/
// کالا/رزرو، همون‌هایی که توی ثبت پست هم قابل‌لینک‌ان)
const overlaySchema = new mongoose.Schema({
type: { type: String, enum: ['text', 'link'], default: 'text' },
text: { type: String, default: '' },
x: { type: Number, default: 0.5 },
y: { type: Number, default: 0.5 },
@@ -10,7 +13,11 @@ const overlaySchema = new mongoose.Schema({
color: { type: String, default: '#ffffff' },
background: { type: String, default: '' },
rotation: { type: Number, default: 0 },
align: { type: String, default: 'center' }
align: { type: String, default: 'center' },
// فقط برای type:'link'
link_kind: { type: String, default: null },
link_id: { type: String, default: null },
link_title: { type: String, default: null }
}, { _id: false })
const storySchema = new mongoose.Schema({
@@ -33,6 +40,11 @@ const storySchema = new mongoose.Schema({
type: [overlaySchema],
default: []
},
linked_post_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Post',
default: null
},
expires_at: {
type: Date,
required: true,
@@ -47,7 +59,23 @@ const storySchema = new mongoose.Schema({
type: Date,
default: Date.now
}
}]
}],
likes: [{
user_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
liked_at: {
type: Date,
default: Date.now
}
}],
admin_status: {
type: String,
enum: ['active', 'inactive'],
default: 'active',
index: true,
},
})
storySchema.index({ expires_at: 1 }, { expireAfterSeconds: 0 })