Team Ai
Apppublic

sanket3280/code-execution

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
InviteToken.js18 linesDownload Raw Back to models
1const mongoose = require('mongoose');2const Schema = mongoose.Schema;3 4const InviteTokenSchema = new Schema({5  token: { type: String, required: true, unique: true },6  invitedBy: { type: Schema.Types.ObjectId, ref: 'User', required: true },7  expiresAt: { type: Date, required: true },8  used: { type: Boolean, default: false },9  usedBy: { type: Schema.Types.ObjectId, ref: 'User' },10  status: { type: String, enum: ['pending', 'accepted', 'rejected', 'expired'], default: 'pending' },11  createdAt: { type: Date, default: Date.now }12});13 14InviteTokenSchema.index({ token: 1 });15InviteTokenSchema.index({ invitedBy: 1 });16InviteTokenSchema.index({ expiresAt: 1 });17 18module.exports = mongoose.model('InviteToken', InviteTokenSchema);