- Installazione primo Sito Web del server

- Creazione prima pagina Home
This commit is contained in:
Surya Paolo
2023-12-09 00:19:40 +01:00
parent 74c4a829b0
commit 502ed32c42
5 changed files with 106 additions and 55 deletions

View File

@@ -107,44 +107,46 @@ const SiteSchema = new Schema({
},
confpages: {
font: { type: String, default: '' },
col_toolbar: { type: String },
col_bgfooter: { type: String },
show_darkopt: { type: Boolean, default: true },
showButtHome: { type: Boolean },
showProfile: { type: Boolean },
showUserMenu: { type: Boolean },
showRegButton: { type: Boolean },
enableReg: { type: Boolean },
showNL: { type: Boolean },
showMsgs: { type: Boolean },
showNotif: { type: Boolean },
showCoins: { type: Boolean },
showNameSurname: { type: Boolean },
showCompetenze: { type: Boolean },
showConnected: { type: Boolean },
bookingEvents: { type: Boolean },
enableEcommerce: { type: Boolean },
enableGroups: { type: Boolean },
enableCircuits: { type: Boolean },
enableProj: { type: Boolean },
enableTodos: { type: Boolean },
enableRegByBot: { type: Boolean },
enableRegMultiChoice: { type: Boolean },
enableDebugOn: { type: Boolean },
enabledRegNeedTelegram: { type: Boolean },
showViewEventi: { type: Boolean },
showViewGroups: { type: Boolean },
showViewCircuits: { type: Boolean },
showViewUsers: { type: Boolean },
showViewBooking: { type: Boolean },
showViewProfile: { type: Boolean },
enablePwa: { type: Boolean },
col_toolbar: { type: String, default: '' },
col_bgfooter: { type: String, default: '' },
show_darkopt: { type: Boolean, default: false },
showButtHome: { type: Boolean, default: false },
showProfile: { type: Boolean, default: false },
showUserMenu: { type: Boolean, default: true },
showiscrittiMenu: { type: Boolean, default: false },
showRegButton: { type: Boolean, default: false },
enableReg: { type: Boolean, default: false },
showNL: { type: Boolean, default: false },
sendNewsletter: { type: Boolean, default: false },
showMsgs: { type: Boolean, default: false },
showNotif: { type: Boolean, default: false },
showCoins: { type: Boolean, default: false },
showNameSurname: { type: Boolean, default: false },
showCompetenze: { type: Boolean, default: false },
showConnected: { type: Boolean, default: false },
bookingEvents: { type: Boolean, default: false },
enableEcommerce: { type: Boolean, default: false },
enableGroups: { type: Boolean, default: false },
enableCircuits: { type: Boolean, default: false },
enableProj: { type: Boolean, default: false },
enableTodos: { type: Boolean, default: false },
enableRegByBot: { type: Boolean, default: false },
enableRegMultiChoice: { type: Boolean, default: false },
enableDebugOn: { type: Boolean, default: false },
enabledRegNeedTelegram: { type: Boolean, default: false },
showViewEventi: { type: Boolean, default: false },
showViewGroups: { type: Boolean, default: false },
showViewCircuits: { type: Boolean, default: false },
showViewUsers: { type: Boolean, default: false },
showViewBooking: { type: Boolean, default: false },
showViewProfile: { type: Boolean, default: false },
enablePwa: { type: Boolean, default: false },
lang: {
type: Number,
default: 0,
},
videoPromo: { type: String },
PDFPromo: { type: String },
videoPromo: { type: String, default: '' },
PDFPromo: { type: String, default: '' },
},
confsite: {
options: { // ConfSite
@@ -153,7 +155,7 @@ const SiteSchema = new Schema({
},
},
policy: {
show: { type: Boolean },
show: { type: Boolean, default: false },
owneremail: { type: String },
siteName: { type: String },
ownerDataName: { type: String },
@@ -164,17 +166,17 @@ const SiteSchema = new Schema({
country: { type: String },
},
contacts: {
facebook: { type: String },
instagram: { type: String },
whatsapp: { type: String },
whatsapp_home: { type: Boolean },
telegram: { type: String },
youtube: { type: String },
email: { type: String },
address: { type: String },
map: { type: String },
info2: { type: String },
cell: { type: String },
facebook: { type: String, default: '' },
instagram: { type: String, default: '' },
whatsapp: { type: String, default: '' },
whatsapp_home: { type: Boolean, default: false },
telegram: { type: String, default: '' },
youtube: { type: String, default: '' },
email: { type: String, default: '' },
address: { type: String, default: '' },
map: { type: String, default: '' },
info2: { type: String, default: '' },
cell: { type: String, default: '' },
},
});
@@ -228,7 +230,7 @@ module.exports.findAll = async function () {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, active: true };
let myfind = { idapp, active: true };
let rec = await Site.findOne(myfind).lean();
if (rec) {
@@ -239,12 +241,28 @@ module.exports.findAllIdApp = async function (idapp) {
// rec.confsite = {};
return rec;
} else {
myfind = { name: 'local' };
let rec = await Site.findOne(myfind).lean();
if (!rec) {
const mysite = new Site();
mysite.name = 'local';
await mysite.save();
mysite.idapp = idapp;
return mysite;
} else {
return rec;
}
}
return {};
};
module.exports.generateNewSite_IdApp = async function (idapp, params) {
module.exports.generateNewSite_IdApp = async function (idapp, params, createpage) {
const { MyPage } = require('../models/mypage');
let ris = null;
@@ -270,6 +288,28 @@ module.exports.generateNewSite_IdApp = async function (idapp, params) {
const ris = await mysite.save();
if (createpage) {
// 1. Crea Pagina principale HOME - Loggato
let myp = new MyPage({
order: 10,
idapp: mysite.idapp,
path: 'home',
active: true,
title: 'Home',
});
let rispag = await myp.save();
// 2. Crea Pagina principale HOME - Non Loggato
myp = new MyPage({
order: 10,
idapp: mysite.idapp,
path: 'home_logout',
active: true,
title: 'Home NoLoggato',
});
rispag = await myp.save();
}
if (ris)
return mysite.idapp;
else