// user-notification.js // Copyright (C) 2022 DTP Technologies, LLC // License: Apache-2.0 'use strict'; const mongoose = require('mongoose'); const Schema = mongoose.Schema; /* * A notification is really just a user-specific bookmark to an event we know * the user is interested in. These are the "timelines" presented to members. */ const UserNotificationSchema = new Schema({ created: { type: Date, default: Date.now, required: true, index: -1, expires: '7d' }, user: { type: Schema.ObjectId, required: true, index: 1, ref: 'User' }, status: { type: String, enum: ['new', 'seen'], default: 'new', required: true }, event: { type: Schema.ObjectId, required: true, ref: 'KaleidoscopeEvent' }, }); module.exports = mongoose.model('UserNotification', UserNotificationSchema);