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.
32 lines
835 B
32 lines
835 B
2 years ago
|
// newsletter.js
|
||
|
// Copyright (C) 2022 DTP Technologies, LLC
|
||
|
// License: Apache-2.0
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
const mongoose = require('mongoose');
|
||
|
|
||
|
const Schema = mongoose.Schema;
|
||
|
|
||
|
const NEWSLETTER_STATUS_LIST = ['draft', 'published', 'archived'];
|
||
|
|
||
|
const NewsletterSchema = new Schema({
|
||
|
created: { type: Date, default: Date.now, required: true, index: -1 },
|
||
|
author: { type: Schema.ObjectId, required: true, index: 1, ref: 'User' },
|
||
|
title: { type: String, required: true },
|
||
|
summary: { type: String },
|
||
|
content: {
|
||
|
html: { type: String, required: true, select: false, },
|
||
|
text: { type: String, required: true, select: false, },
|
||
|
},
|
||
|
status: {
|
||
|
type: String,
|
||
|
enum: NEWSLETTER_STATUS_LIST,
|
||
|
default: 'draft',
|
||
|
required: true,
|
||
|
index: true,
|
||
|
},
|
||
|
});
|
||
|
|
||
|
module.exports = mongoose.model('Newsletter', NewsletterSchema);
|