Files
distri_notification_and_ale…/models/notification.js
T
2025-01-10 13:03:41 +05:30

14 lines
494 B
JavaScript

const mongoose = require('mongoose');
const notificationSchema = new mongoose.Schema({
message: { type: String, required: true },
userId: { type: String, required: true },
priority: { type: String, enum: ['low', 'normal', 'high'], default: 'normal' },
sendTime: { type: Date },
createdAt: { type: Date, default: Date.now },
status: { type: String, enum: ['pending', 'sent', 'failed'], default: 'pending' }
});
module.exports = mongoose.model('Notification', notificationSchema);