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

40
models/ChatRoomModel.js Normal file
View File

@@ -0,0 +1,40 @@
const mongoose = require('mongoose')
const chatRoomSchema = new mongoose.Schema(
{
title: { type: String, required: true, trim: true },
slug: { type: String, required: true, unique: true, trim: true },
description: { type: String, trim: true },
image: { type: String },
members: [{ type: mongoose.Schema.Types.ObjectId, ref: 'User' }],
createdBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
province: {
id: { type: Number },
name: { type: String }
},
city: {
id: { type: Number },
name: { type: String }
},
expertise: { type: String, trim: true },
visibility: {
type: String,
enum: ['public', 'private'],
default: 'public',
index: true,
},
lastActivityAt: { type: Date, default: Date.now, index: true },
idleTimeoutMs: { type: Number, default: 30 * 24 * 60 * 60 * 1000 },
isSystem: { type: Boolean, default: false },
e2ee_enabled: { type: Boolean, default: false },
e2ee_wrapped_keys: [
{
userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
wrappedKey: { type: String, required: true }
}
]
},
{ timestamps: true }
)
module.exports = mongoose.model('ChatRoom', chatRoomSchema)