backend/models/Notifications.js
2023-07-27 23:36:07 -04:00

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);