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.
20 lines
741 B
20 lines
741 B
// user-notification.js
|
|
// Copyright (C) 2022 DTP Technologies, LLC
|
|
// License: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
const mongoose = require('mongoose');
|
|
const Schema = mongoose.Schema;
|
|
|
|
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' },
|
|
source: { type: String, required: true },
|
|
message: { type: String, required: true },
|
|
status: { type: String, enum: ['new', 'seen'], default: 'new', required: true },
|
|
attachmentType: { type: String },
|
|
attachment: { type: Schema.ObjectId, refPath: 'attachmentType' },
|
|
});
|
|
|
|
module.exports = mongoose.model('UserNotification', UserNotificationSchema); |