Spaces:
Paused
Paused
File size: 875 Bytes
c904036 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | const mongoose = require('mongoose');
const notificationSchema = new mongoose.Schema({
targetUserId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true,
},
type: {
type: String,
enum: [
'system',
'feedback',
'chat',
'approval',
'host_request',
'host_status_update',
'institution_request',
'event_reminder',
'rsvp',
'attendance',
'cohost',
'cohost_request',
'event_verification',
],
required: true,
},
message: { type: String, required: true },
data: { type: Object, default: {} },
link: { type: String }, // Link to open when notification is clicked (e.g., /events/:id)
isRead: { type: Boolean, default: false },
createdAt: { type: Date, default: Date.now },
});
module.exports = mongoose.model('Notification', notificationSchema);
|