restore Sites changes over new dtp-base integration

master
rob 2 years ago
parent 0dd25e5176
commit b80737ef1b

@ -0,0 +1,29 @@
// page.js
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const PAGE_STATUS_LIST = ['draft','published','archived'];
const PageSchema = new Schema({
title: { type: String, required: true },
slug: { type: String, required: true, lowercase: true, unique: true },
image: {
header: { type: Schema.ObjectId, ref: 'Image' },
icon: { type: Schema.ObjectId, ref: 'Image' },
},
content: { type: String, required: true, select: false },
status: { type: String, enum: PAGE_STATUS_LIST, default: 'draft', index: true },
menu: {
icon: { type: String, required: true },
label: { type: String, required: true },
order: { type: Number, default: 0, required: true },
parent: { type: Schema.ObjectId, index: 1, ref: 'Page' },
},
});
module.exports = mongoose.model('Page', PageSchema);

@ -0,0 +1,36 @@
// post.js
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
const path = require('path');
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const {
ResourceStats,
ResourceStatsDefaults,
} = require(path.join(__dirname, 'lib', 'resource-stats.js'));
const POST_STATUS_LIST = ['draft','published','archived'];
const PostSchema = new Schema({
created: { type: Date, default: Date.now, required: true, index: -1 },
updated: { type: Date },
author: { type: Schema.ObjectId, required: true, index: 1, ref: 'User' },
image: { type: Schema.ObjectId, ref: 'Image' },
title: { type: String, required: true },
slug: { type: String, required: true, lowercase: true, unique: true },
summary: { type: String, required: true },
content: { type: String, required: true, select: false },
status: { type: String, enum: POST_STATUS_LIST, default: 'draft', index: true },
stats: { type: ResourceStats, default: ResourceStatsDefaults, required: true },
flags: {
enableComments: { type: Boolean, default: true, index: true },
isFeatured: { type: Boolean, default: false, index: true },
},
});
module.exports = mongoose.model('Post', PostSchema);

@ -1,5 +1,5 @@
// session.js
// Copyright (C) 2022 DTP Technologies, LLC
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';

@ -1,5 +1,5 @@
// limiter.js
// Copyright (C) 2022 DTP Technologies, LLC
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
@ -70,6 +70,38 @@ module.exports = {
},
},
/*
* CryptoExchangeController
*/
cryptoExchange: {
getRateGraph: {
total: 10,
expire: ONE_MINUTE,
message: 'You are loading exchange rate graphs too quickly',
},
getCurrentRates: {
total: 10,
expire: ONE_MINUTE,
message: 'You are loading cryptocurrency exchange rates too quickly',
},
},
/*
* DashboardController
*/
dashboard: {
getEpisodeView: {
total: 15,
expire: ONE_MINUTE,
message: 'You are loading the dashboard episode view too quickly',
},
getHome: {
total: 15,
expire: ONE_MINUTE,
message: 'You are loading the publisher dashboard too quickly',
},
},
/*
* EmailController
*/
@ -127,6 +159,54 @@ module.exports = {
}
},
/*
* NewsletterController
*/
newsletter: {
getView: {
total: 5,
expire: ONE_MINUTE,
message: 'You are reading newsletters too quickly',
},
getIndex: {
total: 60,
expire: ONE_MINUTE,
message: 'You are fetching newsletters too quickly',
},
},
/*
* PageController
*/
page: {
getView: {
total: 5,
expire: ONE_MINUTE,
message: 'You are reading pages too quickly',
},
},
/*
* PostController
*/
post: {
getComments: {
total: 20,
expire: ONE_MINUTE,
message: 'You are reading comments too quickly',
},
getView: {
total: 5,
expire: ONE_MINUTE,
message: 'You are reading posts too quickly',
},
getIndex: {
total: 60,
expire: ONE_MINUTE,
message: 'You are refreshing too quickly',
},
},
/*
* UserController
*/
@ -178,4 +258,4 @@ module.exports = {
expire: ONE_MINUTE,
message: 'You are loading these pages too quickly',
},
};
};

Loading…
Cancel
Save