Spaces:
Running

messenger / models /Pin.js
4SEND
deploy: sessions/pins/calls/video-message fixes + rebuilt client assets
c4341fd
Raw History Blame Contribute Delete
578 Bytes
const mongoose = require('mongoose');
const PinSchema = new mongoose.Schema({
message_id: { type: mongoose.Schema.Types.ObjectId, ref: 'Message' },
chat_id: { type: String, index: true },
pinner_id: { type: String },
pin_type: { type: String, enum: ['both', 'me', 'self'], default: 'both' },
text_preview: { type: String },
timestamp: { type: Date, default: Date.now }
});
PinSchema.index({ chat_id: 1, pinner_id: 1 });
PinSchema.index({ message_id: 1, chat_id: 1, pinner_id: 1 }, { unique: true });
module.exports = mongoose.model('Pin', PinSchema);