kba / models /Notification.js
ShieldX's picture
Upload 24 files
e14bacb verified
raw
history blame contribute delete
487 Bytes
const mongoose = require('mongoose');
const notificationSchema = new mongoose.Schema({
title: { type: String, required: true },
message: { type: String, required: true },
type: { type: String, enum: ['INFO', 'ALERT', 'WIN', 'UPDATE'], default: 'INFO' },
target_user_id: { type: mongoose.Schema.Types.ObjectId, ref: 'User', default: null },
created_at: { type: Date, default: Date.now, expires: '3d' }
});
module.exports = mongoose.model('Notification', notificationSchema);