committed
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const userSchema = new mongoose.Schema({
|
||||
userId: { type: String, required: true, unique: true },
|
||||
preferences: {
|
||||
channels: [{ type: String, enum: ['email', 'sms', 'push'] }],
|
||||
quietHours: {
|
||||
start: { type: String, match: /^([01]\d|2[0-3]):([0-5]\d)$/ },
|
||||
end: { type: String, match: /^([01]\d|2[0-3]):([0-5]\d)$/ }
|
||||
},
|
||||
notificationLimit: { type: Number, default: 3 }
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = mongoose.model('User', userSchema);
|
||||
|
||||
Reference in New Issue
Block a user