Arcadei...
This commit is contained in:
74
src/server/models/myelem.js
Executable file
74
src/server/models/myelem.js
Executable file
@@ -0,0 +1,74 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const MyElemSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
container: {
|
||||
type: String,
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
},
|
||||
order: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
},
|
||||
onlyif_logged: {
|
||||
type: Boolean,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
},
|
||||
class: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
MyElemSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'title', type: tools.FieldType.string },
|
||||
{ field: 'content', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
MyElemSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
MyElemSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const MyElem = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await MyElem.find(myfind, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
};
|
||||
|
||||
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
||||
|
||||
module.exports = { MyElem };
|
||||
@@ -25,9 +25,15 @@ const MyPageSchema = new Schema({
|
||||
title: {
|
||||
type: String,
|
||||
},
|
||||
subtitle: {
|
||||
type: String,
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
},
|
||||
iconsize: {
|
||||
type: String,
|
||||
},
|
||||
order: {
|
||||
type: Number,
|
||||
default: 1000,
|
||||
@@ -116,6 +122,9 @@ const MyPageSchema = new Schema({
|
||||
infooter: {
|
||||
type: Boolean,
|
||||
},
|
||||
extraclass: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
MyPageSchema.statics.getFieldsForSearch = function () {
|
||||
@@ -147,6 +156,7 @@ MyPageSchema.statics.findOnlyStruttRec = function (idapp) {
|
||||
|
||||
return MyPage.find(myfind, {
|
||||
title: 1,
|
||||
subtitle: 1,
|
||||
icon: 1,
|
||||
order: 1,
|
||||
keywords: 1,
|
||||
@@ -156,7 +166,9 @@ MyPageSchema.statics.findOnlyStruttRec = function (idapp) {
|
||||
onlyif_logged: 1,
|
||||
only_residenti: 1,
|
||||
inmenu: 1,
|
||||
submenu: 1
|
||||
submenu: 1,
|
||||
iconsize: 1,
|
||||
extraclass: 1,
|
||||
}, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
|
||||
@@ -1205,6 +1205,7 @@ function load(req, res, version) {
|
||||
const contribtype = Contribtype.findAllIdApp(idapp);
|
||||
const paymenttype = PaymentType.findAllIdApp(idapp);
|
||||
const disciplines = Discipline.findAllIdApp(idapp);
|
||||
const myelems = MyElem.findAllIdApp(idapp);
|
||||
const settings = Settings.findAllIdApp(idapp, false, false);
|
||||
|
||||
const permissions = Permission.findAllIdApp();
|
||||
@@ -1313,6 +1314,7 @@ function load(req, res, version) {
|
||||
site,
|
||||
mygroups,
|
||||
listcircuits, // 37
|
||||
myelems, // 38
|
||||
]).then((arrdata) => {
|
||||
// console.table(arrdata);
|
||||
let myuser = req.user;
|
||||
@@ -1393,6 +1395,7 @@ function load(req, res, version) {
|
||||
site: arrdata[35],
|
||||
mygroups: arrdata[36],
|
||||
listcircuits: arrdata[37],
|
||||
myelems: arrdata[38],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,15 @@ if ((process.env.NODE_ENV === 'production') ||
|
||||
};
|
||||
var https = require('https');
|
||||
} else {
|
||||
if (process.env.HTTPS_LOCALHOST) {
|
||||
if (process.env.HTTPS_LOCALHOST === "true") {
|
||||
var privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
||||
var certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
||||
var credentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
|
||||
honorCipherOrder: true,
|
||||
secureProtocol: 'TLSv1_2_method',
|
||||
};
|
||||
var https = require('https');
|
||||
|
||||
@@ -98,6 +101,7 @@ myLoad().then(ris => {
|
||||
require('./models/mailinglist');
|
||||
require('./models/newstosent');
|
||||
require('./models/mypage');
|
||||
require('./models/myelem');
|
||||
require('./models/bot');
|
||||
require('./models/calzoom');
|
||||
const mysql_func = require('./mysql/mysql_func');
|
||||
@@ -231,7 +235,7 @@ myLoad().then(ris => {
|
||||
}
|
||||
|
||||
if ((process.env.NODE_ENV === 'production') ||
|
||||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST) {
|
||||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST === "true") {
|
||||
var httpsServer = https.createServer(credentials, app);
|
||||
console.log('httpsServer: port ', port);
|
||||
httpsServer.listen(port);
|
||||
|
||||
@@ -41,6 +41,7 @@ const {Movement} = require('../models/movement');
|
||||
const Pickup = require('../models/pickup');
|
||||
const {Newstosent} = require('../models/newstosent');
|
||||
const {MyPage} = require('../models/mypage');
|
||||
const {MyElem} = require('../models/myelem');
|
||||
const {MyBot} = require('../models/bot');
|
||||
const {CfgServer} = require('../models/cfgserver');
|
||||
const {CalZoom} = require('../models/calzoom');
|
||||
@@ -142,6 +143,8 @@ module.exports = {
|
||||
mytable = Gallery;
|
||||
else if (tablename === 'mypage')
|
||||
mytable = MyPage;
|
||||
else if (tablename === 'myelems')
|
||||
mytable = MyElem;
|
||||
else if (tablename === 'bots')
|
||||
mytable = MyBot;
|
||||
else if (tablename === 'cfgservers')
|
||||
|
||||
Reference in New Issue
Block a user