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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user