This commit is contained in:
payacom
2026-10-01 21:12:05 +03:30
parent 806471241e
commit d4ebc20aa8
41 changed files with 1015 additions and 135 deletions

View File

@@ -22,6 +22,15 @@ const userSchema = new mongoose.Schema({
required: false,
default: null
},
// شماره‌ای که کاربرِ گوگلی/اینستاگرامیِ بدونِ موبایل، در حینِ فرایندِ تک‌مرحله‌ایِ
// «ثبت شماره موبایل» (تنظیمات) وارد کرده و منتظرِ تاییدِ OTP ـه — بعد از تایید،
// به mobile منتقل می‌شه و خودش null می‌شه
pending_mobile: {
type: String,
required: false,
trim: true,
default: null
},
email: {
type: String,
required: false,
@@ -172,6 +181,25 @@ const userSchema = new mongoose.Schema({
enum: ['none', 'gray', 'blue', 'green', 'gold'],
default: 'none'
},
// کاربرِ زیرمجموعه — یه سندِ UserModel معمولی که به‌جای اکانتِ خودش، اکانتِ
// parent_account_id رو مدیریت می‌کنه؛ فقط با پرمیژن‌های sub_user_permissions
parent_account_id: {
type: mongoose.Schema.Types.ObjectId,
ref: 'UserModel',
default: null
},
is_sub_user: {
type: Boolean,
default: false
},
sub_user_active: {
type: Boolean,
default: true
},
sub_user_permissions: {
type: [String],
default: []
},
profile_image: {
type: String,
required: false,
@@ -803,17 +831,6 @@ const userSchema = new mongoose.Schema({
required: false,
default: null
},
// یک رشته‌ی تصادفیِ ۳۲بایتیِ per-account که با درخواستِ احرازهویت‌شده به همین
// اکانت، از هر دستگاهی (وب/اندروید) قابل‌دریافته — به‌جای PIN دستی، به‌عنوانِ
// رمزِ رمزنگاریِ e2ee_key_backup استفاده می‌شه تا بازیابیِ هویتِ E2EE روی دستگاهِ
// جدید کاملاً خودکار و بدون دخالتِ کاربر انجام بشه. توجه: این یعنی تضمینِ
// end-to-end دیگه واقعی نیست — هرکسی که به این فیلد (یا سرور) دسترسی پیدا کنه
// می‌تونه بک‌آپ رو باز کنه؛ این تصمیم آگاهانه به نفعِ هیچ‌وقت‌گم‌نشدنِ پیام‌ها گرفته شده
e2ee_auto_backup_secret: {
type: String,
required: false,
default: null
},
pinned_post_ids: {
type: [{
type: mongoose.Schema.Types.ObjectId,