Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 1x 1x | const mongoose = require('mongoose');
/**
* EventParticipationLog Schema for CampVerse
* Includes payment info, attendance timestamp, and QR token for ticketing
*/
const eventParticipationLogSchema = new mongoose.Schema({
userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
eventId: { type: mongoose.Schema.Types.ObjectId, ref: 'Event', required: true },
status: { type: String, enum: ['registered', 'waitlisted', 'attended'], required: true },
timestamp: { type: Date, default: Date.now },
paymentType: { type: String, enum: ['free', 'paid'], default: 'free' },
paymentStatus: { type: String, enum: ['success', 'pending', 'failed'], default: 'success' },
attendanceTimestamp: { type: Date },
qrToken: { type: String }, // Secure token for QR code validation
attendanceMarkedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, // Host/co-host who scanned
attendanceMarkedAt: { type: Date }, // When attendance was marked (scan time)
});
eventParticipationLogSchema.index({ userId: 1, eventId: 1 }, { unique: true });
module.exports = mongoose.model('EventParticipationLog', eventParticipationLogSchema);
|