backend/models/Notifications.js

13 lines
486 B
JavaScript
Raw Normal View History

2023-07-28 03:36:07 +00:00
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);