13 lines
486 B
JavaScript
13 lines
486 B
JavaScript
|
const mongoose = require('mongoose');
|
||
|
|
||
|
const notificationSchema = new mongoose.Schema({
|
||
|
user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
||
|
type: String, // 'like', 'comment', or 'follow'
|
||
|
from: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
|
||
|
swit: { type: mongoose.Schema.Types.ObjectId, ref: 'Swit' },
|
||
|
read: { type: Boolean, default: false },
|
||
|
date: { type: Date, default: Date.now }
|
||
|
});
|
||
|
|
||
|
module.exports = mongoose.model('Notification', notificationSchema);
|