DTP Social Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
1.0 KiB

// user-notification.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const NOTIFICATION_STATUS_LIST = ['new', 'seen'];
/*
* A notification is a user-specific bookmark to an event we know the user is
* interested in. These are the "timelines" presented to members.
*
* Notifications are only created for LOCAL users (not Core users). A
* notification sent to a CoreUser will be delivered to their Core. When it
* arrives, it becomes a UserNotification for that local user on that Core.
*/
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: NOTIFICATION_STATUS_LIST, default: 'new', required: true },
event: { type: Schema.ObjectId, required: true, ref: 'KaleidoscopeEvent' },
});
module.exports = mongoose.model('UserNotification', UserNotificationSchema);