From 1ca8dcd184b29ba2a9a96d0fc85c5c4d4730868f Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Sun, 20 Nov 2022 10:20:56 +0100 Subject: [PATCH] Animations in the WebEditor --- src/server/models/mypage.js | 72 ++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/src/server/models/mypage.js b/src/server/models/mypage.js index bac6b3d..ce41a70 100755 --- a/src/server/models/mypage.js +++ b/src/server/models/mypage.js @@ -125,13 +125,19 @@ const MyPageSchema = new Schema({ extraclass: { type: String, }, + loadFirst: { + type: Boolean, + }, + showFooter: { + type: Boolean, + } }); MyPageSchema.statics.getFieldsForSearch = function () { return [{ field: 'title', type: tools.FieldType.string }, - { field: 'keywords', type: tools.FieldType.string }, - { field: 'description', type: tools.FieldType.string }, - { field: 'content', type: tools.FieldType.string }] + { field: 'keywords', type: tools.FieldType.string }, + { field: 'description', type: tools.FieldType.string }, + { field: 'content', type: tools.FieldType.string }] }; MyPageSchema.statics.executeQueryTable = function (idapp, params, user) { @@ -149,35 +155,53 @@ MyPageSchema.statics.findAllIdApp = async function (idapp) { }); }; -MyPageSchema.statics.findOnlyStruttRec = function (idapp) { +MyPageSchema.statics.findOnlyStruttRec = async function (idapp) { const MyPage = this; - const myfind = { idapp }; + const arrFirst = await MyPage.find( + { + idapp, + loadFirst: true, + }, + (err, arrrec) => { + return arrrec + }); + + const arrfixed = await MyPage.find( + { idapp, + $or: [ + {loadFirst: {$exists: false}}, + {loadFirst: {$exists: true, $eq: false}}], + } + , { + title: 1, + subtitle: 1, + icon: 1, + order: 1, + keywords: 1, + description: 1, + path: 1, + active: 1, + onlyif_logged: 1, + only_residenti: 1, + inmenu: 1, + submenu: 1, + iconsize: 1, + extraclass: 1, + loadFirst: 1, + }, (err, arrrec) => { + return arrrec + }); + + return [...arrFirst, ...arrfixed]; - return MyPage.find(myfind, { - title: 1, - subtitle: 1, - icon: 1, - order: 1, - keywords: 1, - description: 1, - path: 1, - active: 1, - onlyif_logged: 1, - only_residenti: 1, - inmenu: 1, - submenu: 1, - iconsize: 1, - extraclass: 1, - }, (err, arrrec) => { - return arrrec - }); }; MyPageSchema.statics.findInternalPages = async function (idapp) { const MyPage = this; - const myfind = { idapp, + const myfind = { + idapp, internalpage: { $exists: true, $eq: true } };