Compare commits
9 Commits
preced_all
...
server_1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4758ce0857 | ||
|
|
6579c6bb3f | ||
|
|
6270991b76 | ||
|
|
f6d8e1bb0b | ||
|
|
f3597facd3 | ||
|
|
8363d65456 | ||
|
|
0a4cea94ae | ||
|
|
53a70a1c96 | ||
|
|
45d06b0923 |
@@ -8,16 +8,13 @@ appTelegram_TEST=["1","17"]
|
|||||||
appTelegram=["1","17"]
|
appTelegram=["1","17"]
|
||||||
appTelegram_DEVELOP=["17"]
|
appTelegram_DEVELOP=["17"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=0
|
||||||
MONGODB_USER=admin
|
|
||||||
MONGODB_PWD=mypwadmin@1A
|
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
URLBASE_APP1=https://localhost
|
URLBASE_APP1=https://localhost
|
||||||
PORT_APP1=8080
|
PORT_APP1=8080
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
HTTPS_LOCALHOST=true
|
HTTPS_LOCALHOST=true
|
||||||
VITE_DEBUG=0
|
VITE_DEBUG=0
|
||||||
VITE_DEBUG=0
|
|
||||||
TESTING_ON=1
|
TESTING_ON=1
|
||||||
LOCALE=1
|
LOCALE=1
|
||||||
DELAY_SENDEMAIL=2000
|
DELAY_SENDEMAIL=2000
|
||||||
@@ -45,6 +42,5 @@ MIAB_HOST=box.lamiaposta.org
|
|||||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||||
|
|
||||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
||||||
SERVER_A_URL="http://51.77.156.69:3000"
|
SERVER_A_URL="http://51.77.156.69:3000"
|
||||||
@@ -8,16 +8,13 @@ appTelegram_TEST=["1","13"]
|
|||||||
appTelegram=["1","13"]
|
appTelegram=["1","13"]
|
||||||
appTelegram_DEVELOP=["13"]
|
appTelegram_DEVELOP=["13"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=0
|
||||||
MONGODB_USER=admin
|
|
||||||
MONGODB_PWD=mypwadmin@1A
|
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
URLBASE_APP1=https://localhost
|
URLBASE_APP1=https://localhost
|
||||||
PORT_APP1=8080
|
PORT_APP1=8080
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
HTTPS_LOCALHOST=true
|
HTTPS_LOCALHOST=true
|
||||||
VITE_DEBUG=0
|
VITE_DEBUG=0
|
||||||
VITE_DEBUG=0
|
|
||||||
TESTING_ON=1
|
TESTING_ON=1
|
||||||
LOCALE=1
|
LOCALE=1
|
||||||
DELAY_SENDEMAIL=2000
|
DELAY_SENDEMAIL=2000
|
||||||
|
|||||||
@@ -1,23 +1,20 @@
|
|||||||
DATABASE=test_PiuCheBuono
|
DATABASE=test_FreePlanet
|
||||||
UDB=paofreeplanet
|
UDB=paofreeplanet
|
||||||
PDB=mypassword@1A
|
PDB=mypassword@1A
|
||||||
SEND_EMAIL=0
|
SEND_EMAIL=0
|
||||||
SEND_EMAIL_ORDERS=1
|
SEND_EMAIL_ORDERS=1
|
||||||
PORT=3000
|
PORT=3000
|
||||||
appTelegram_TEST=["1","17"]
|
appTelegram_TEST=["1","13"]
|
||||||
appTelegram=["1","17"]
|
appTelegram=["1","13"]
|
||||||
appTelegram_DEVELOP=["17"]
|
appTelegram_DEVELOP=["13"]
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=0
|
||||||
MONGODB_USER=admin
|
|
||||||
MONGODB_PWD=mypwadmin@1A
|
|
||||||
ENABLE_PUSHNOTIFICATION=1
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
URLBASE_APP1=https://localhost
|
URLBASE_APP1=https://localhost
|
||||||
PORT_APP1=8080
|
PORT_APP1=8080
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
HTTPS_LOCALHOST=true
|
HTTPS_LOCALHOST=true
|
||||||
VITE_DEBUG=0
|
VITE_DEBUG=0
|
||||||
VITE_DEBUG=0
|
|
||||||
TESTING_ON=1
|
TESTING_ON=1
|
||||||
LOCALE=1
|
LOCALE=1
|
||||||
DELAY_SENDEMAIL=2000
|
DELAY_SENDEMAIL=2000
|
||||||
@@ -32,7 +29,7 @@ GCM_API_KEY=""
|
|||||||
PROD=0
|
PROD=0
|
||||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||||
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
||||||
TOKEN_LIFE=2h
|
TOKEN_LIFE=1m
|
||||||
REFRESH_TOKEN_LIFE=14d
|
REFRESH_TOKEN_LIFE=14d
|
||||||
FTPSERVER_HOST=139.162.166.31
|
FTPSERVER_HOST=139.162.166.31
|
||||||
FTPSERVER_PORT=21
|
FTPSERVER_PORT=21
|
||||||
@@ -41,10 +38,4 @@ FTPSERVER_PWD=ftpmypwd@1A_
|
|||||||
AUTH_NEW_SITES=123123123
|
AUTH_NEW_SITES=123123123
|
||||||
SCRIPTS_DIR=admin_scripts
|
SCRIPTS_DIR=admin_scripts
|
||||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||||
MIAB_HOST=box.lamiaposta.org
|
|
||||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
|
||||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
|
||||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||||
|
|
||||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
|
||||||
SERVER_A_URL="http://51.77.156.69:3000"
|
|
||||||
@@ -8,7 +8,9 @@ DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
|||||||
SERVERDIR_WEBSITE=/var/www/www.freeplanet_server
|
SERVERDIR_WEBSITE=/var/www/www.freeplanet_server
|
||||||
PORT_APP1="0"
|
PORT_APP1="0"
|
||||||
DOMAIN=mongodb://localhost:27017/
|
DOMAIN=mongodb://localhost:27017/
|
||||||
|
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:27017/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=1
|
||||||
|
AUTH_DB_PASSING=1
|
||||||
MONGODB_USER=admin
|
MONGODB_USER=admin
|
||||||
MONGODB_PWD=mypwadminREAL@1A
|
MONGODB_PWD=mypwadminREAL@1A
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
@@ -19,7 +21,7 @@ VAPI_KEY_SUBJECT="mailto:paolo@freeplanet.app"
|
|||||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
PATH_CERT_KEY=key.pem
|
PATH_CERT_KEY=privkey.pem
|
||||||
PATH_SERVER_CRT=fullchain.pem
|
PATH_SERVER_CRT=fullchain.pem
|
||||||
PATH_SSL_ROOT_PEM=root.pem
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
PATH_SSL_CHAIN_PEM=chain.pem
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ DIRECTORY_SERVER=/var/www/nodejs_piuchebuono_server
|
|||||||
SERVERDIR_WEBSITE=/var/www/piuchebuono.app
|
SERVERDIR_WEBSITE=/var/www/piuchebuono.app
|
||||||
PORT_APP1="0"
|
PORT_APP1="0"
|
||||||
DOMAIN=mongodb://localhost:32001/
|
DOMAIN=mongodb://localhost:32001/
|
||||||
|
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32001/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=1
|
||||||
|
AUTH_DB_PASSING=1
|
||||||
MONGODB_USER=admin
|
MONGODB_USER=admin
|
||||||
MONGODB_PWD=mypwadminREAL@1A
|
MONGODB_PWD=mypwadminREAL@1A
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ DIRECTORY_SERVER=/var/www/nodejs_riso_server
|
|||||||
SERVERDIR_WEBSITE=/var/www/riso.app
|
SERVERDIR_WEBSITE=/var/www/riso.app
|
||||||
PORT_APP1="0"
|
PORT_APP1="0"
|
||||||
DOMAIN=mongodb://localhost:32015/
|
DOMAIN=mongodb://localhost:32015/
|
||||||
|
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32015/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=1
|
||||||
|
AUTH_DB_PASSING=1
|
||||||
MONGODB_USER=admin
|
MONGODB_USER=admin
|
||||||
MONGODB_PWD=mypwadminREAL@1A
|
MONGODB_PWD=mypwadminREAL@1A
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ DIRECTORY_SERVER=/var/www/nodejs_test.piuchebuono_server
|
|||||||
SERVERDIR_WEBSITE=var/www/test.piuchebuono.app
|
SERVERDIR_WEBSITE=var/www/test.piuchebuono.app
|
||||||
PORT_APP1="0"
|
PORT_APP1="0"
|
||||||
DOMAIN=mongodb://localhost:32002/
|
DOMAIN=mongodb://localhost:32002/
|
||||||
|
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32002/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=1
|
||||||
|
AUTH_DB_PASSING=1
|
||||||
MONGODB_USER=admin
|
MONGODB_USER=admin
|
||||||
MONGODB_PWD=mypwadmin@1A
|
MONGODB_PWD=mypwadmin@1A
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
@@ -22,7 +24,7 @@ VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
|||||||
PUBLIC_VAPI_KEY="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
|
PUBLIC_VAPI_KEY="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
|
||||||
PRIVATE_VAPI_KEY="LVpFDJuKscdHuQr5pe20dFuYuWX1-ZRb6x72PP-Pp4I"
|
PRIVATE_VAPI_KEY="LVpFDJuKscdHuQr5pe20dFuYuWX1-ZRb6x72PP-Pp4I"
|
||||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
PATH_CERT_KEY=key.pem
|
PATH_CERT_KEY=privkey.pem
|
||||||
PATH_SERVER_CRT=fullchain.pem
|
PATH_SERVER_CRT=fullchain.pem
|
||||||
PATH_SSL_ROOT_PEM=root.pem
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
PATH_SSL_CHAIN_PEM=chain.pem
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
|||||||
@@ -8,18 +8,20 @@ DIRECTORY_SERVER=/var/www/nodejs_test.riso_server
|
|||||||
SERVERDIR_WEBSITE=/var/www/test.riso.app
|
SERVERDIR_WEBSITE=/var/www/test.riso.app
|
||||||
PORT_APP1="0"
|
PORT_APP1="0"
|
||||||
DOMAIN=mongodb://localhost:32012/
|
DOMAIN=mongodb://localhost:32012/
|
||||||
|
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32012/
|
||||||
AUTH_MONGODB=1
|
AUTH_MONGODB=1
|
||||||
MONGODB_USER=admin
|
AUTH_DB_PASSING=1
|
||||||
MONGODB_PWD=mypwadmin@1A
|
MONGODB_USER="admin"
|
||||||
|
MONGODB_PWD="mypwadminS1A"
|
||||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
VITE_DEBUG=0
|
VITE_DEBUG=1
|
||||||
LOCALE=0
|
LOCALE=0
|
||||||
DELAY_SENDEMAIL=1000
|
DELAY_SENDEMAIL=1000
|
||||||
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
||||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
PATH_CERT_KEY=key.pem
|
PATH_CERT_KEY=privkey.pem
|
||||||
PATH_SERVER_CRT=fullchain.pem
|
PATH_SERVER_CRT=fullchain.pem
|
||||||
PATH_SSL_ROOT_PEM=root.pem
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
PATH_SSL_CHAIN_PEM=chain.pem
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ VAPI_KEY_SUBJECT="mailto:paolo@freeplanet.app"
|
|||||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
PATH_CERT_KEY=key.pem
|
PATH_CERT_KEY=privkey.pem
|
||||||
PATH_SERVER_CRT=fullchain.pem
|
PATH_SERVER_CRT=fullchain.pem
|
||||||
PATH_SSL_ROOT_PEM=root.pem
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
PATH_SSL_CHAIN_PEM=chain.pem
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
|||||||
76
OFF_deploynodejs_on_production.sh.off
Executable file
76
OFF_deploynodejs_on_production.sh.off
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.production
|
||||||
|
|
||||||
|
msg="*** SERVER DI PRODUZIONE **** SEI SICURO DI INVIARE GLI AGGIORNAMENTI SERVERSIDE (NODE JS) - SUL SERVER DI PRODUZIONE ?? $SERVERDIR_WEBSITE (Y/N) ? "
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
read -p "$msg" risposta
|
||||||
|
else
|
||||||
|
echo $msg
|
||||||
|
risposta=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso NODEPRODUZIONE ... $SERVERDIR_WEBSITE/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="suryapaolo"
|
||||||
|
REMOTE_HOST="servereng"
|
||||||
|
REMOTE_PORT="8855"
|
||||||
|
REMOTE_DIR="$SERVERDIR_WEBSITE"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"admin_scripts"
|
||||||
|
"sass"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Sincronizzazione Cartelle su $REMOTE_DIR ..."
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file .env.production ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
.env.production "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
ecosystem.config.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Sincronizzazione completata con successo. SERVER PRODUZIONE! "
|
||||||
|
else
|
||||||
|
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
db.myelems.insertMany([
|
db.myelems.insertMany([
|
||||||
{
|
{
|
||||||
"_id": ObjectId("669fbf9dc9d625d0628eb12f"),
|
"_id": new ObjectId("669fbf9dc9d625d0628eb12f"),
|
||||||
"order": 20,
|
"order": 20,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 20,
|
"type": 20,
|
||||||
@@ -13,14 +13,14 @@ db.myelems.insertMany([
|
|||||||
"__v": 0,
|
"__v": 0,
|
||||||
"containerHtml": "<div style=\"text-align: center;\"><b><font size=\"4\">Abitare Gli Iblei</font></b></div>",
|
"containerHtml": "<div style=\"text-align: center;\"><b><font size=\"4\">Abitare Gli Iblei</font></b></div>",
|
||||||
"anim": {
|
"anim": {
|
||||||
"_id": ObjectId("66e456981e0719a1012121c0"),
|
"_id": new ObjectId("66e456981e0719a1012121c0"),
|
||||||
"name": "",
|
"name": "",
|
||||||
"clduration": "",
|
"clduration": "",
|
||||||
"cldelay": "",
|
"cldelay": "",
|
||||||
"timingtype": "ease-in-out"
|
"timingtype": "ease-in-out"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"_id": ObjectId("669fbfc3c9d625d0628eb131"),
|
"_id": new ObjectId("669fbfc3c9d625d0628eb131"),
|
||||||
"order": 100,
|
"order": 100,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 145,
|
"type": 145,
|
||||||
@@ -32,7 +32,7 @@ db.myelems.insertMany([
|
|||||||
"list": [],
|
"list": [],
|
||||||
"__v": 0
|
"__v": 0
|
||||||
}, {
|
}, {
|
||||||
"_id": ObjectId("66db2a45054b3b09f85e6983"),
|
"_id": new ObjectId("66db2a45054b3b09f85e6983"),
|
||||||
"order": 26,
|
"order": 26,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 35,
|
"type": 35,
|
||||||
@@ -45,7 +45,7 @@ db.myelems.insertMany([
|
|||||||
"__v": 0,
|
"__v": 0,
|
||||||
"image": "logo.jpg",
|
"image": "logo.jpg",
|
||||||
"anim": {
|
"anim": {
|
||||||
"_id": ObjectId("66db34215740efc77547a93a"),
|
"_id": new ObjectId("66db34215740efc77547a93a"),
|
||||||
"name": "",
|
"name": "",
|
||||||
"clduration": "",
|
"clduration": "",
|
||||||
"cldelay": "",
|
"cldelay": "",
|
||||||
@@ -55,7 +55,7 @@ db.myelems.insertMany([
|
|||||||
"align": 2
|
"align": 2
|
||||||
}
|
}
|
||||||
, {
|
, {
|
||||||
"_id": ObjectId("66db38a77e24f4509eef655b"),
|
"_id": new ObjectId("66db38a77e24f4509eef655b"),
|
||||||
"order": 26,
|
"order": 26,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 20,
|
"type": 20,
|
||||||
@@ -68,7 +68,7 @@ db.myelems.insertMany([
|
|||||||
"__v": 0,
|
"__v": 0,
|
||||||
"containerHtml": "<style>\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 20px;\n background-color: #f0f0f0;\n color: #333;\n}\n\nh1 {\n color: #0056b3;\n text-align: center;\n}\n\n\np, li {\n line-height: 1.6;\n}\n\n\nul {\n list-style-type: none;\n padding: 0;\n}\n\n\nli {\n background-color: #fff !important;\n margin-bottom: 10px !important;\n padding: 10px !important;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; \n}\n\n\na {\n color: #007bff;\n text-decoration: none;\n}\n\n\na:hover {\n text-decoration: underline;\n}\n\n\n.container {\n max-width: 800px;\n margin: 0 auto;\n background-color: #fff;\n padding: 20px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n}\n\n\n.strong {\n font-weight: bold;\n}\n</style>\n\n\n<p><strong>“Abitare gli Iblei”</strong> è una rete aperta che ha lo scopo di riunire tutte quelle persone che vogliono valorizzare e qualificare la vita nel territorio degli Iblei. </p>\n \n <p>Chi aderisce alla rete si riconosce in una <strong>Carta dei valori comuni</strong> e usa la rete per scambiare conoscenze, esperienze, risorse e prodotti sviluppati nell’ambito delle proprie iniziative (profit e non profit) individuali o collettive.</p>\n\n\n <p>L’area territoriale di questa rete è quella dei <strong>Monti Iblei orientali e occidentali</strong> (Noto, Avola, Canicattini, Siracusa, Palazzolo, Buccheri, Ferla, Modica, …).</p>\n\n\n <p>La rete <strong>“Abitare gli Iblei”</strong> offre i seguenti servizi utili per il territorio ed i suoi abitanti, frutto di una costruzione collettiva:</p>\n \n <ul>\n <li><strong>1. Mappa delle attività virtuose:</strong> permette di identificare attività pubbliche e private nel territorio che possono essere utili nella vita quotidiana. Queste attività possono riguardare artigiani, produttori o fornitori di servizi di cui almeno un membro della rete conosca la qualità e l’affidabilità (agricoltori, falegnami, fabbri, idraulici, imprese edili, strutture ricettive, …). Altre informazioni utili possono riguardare associazioni/istituzioni operanti in vari settori. – <strong>Accesso pubblico</strong></li>\n <li><strong>2. Calendario:</strong> permette di accedere ad annunci di eventi utili alla crescita culturale del territorio. La pubblicazione di eventi è riservata ai soli membri della rete che possono presentare iniziative anche di altri organizzatori. – <strong>Accesso pubblico</strong></li>\n <li><strong>3. Scambi di servizi, prodotti e ospitalità:</strong> questa funzione è riservata ai soli membri della rete e si realizza attraverso la Rete italiana di scambi orizzontali (RISO). – <strong>Accesso riservato</strong></li>\n <li><strong>4. Segnalazione di pericoli per il territorio:</strong> attraverso questa mappa è possibile segnalare incendi, immondizia abbandonata, discariche abusive, fonti di inquinamento per corsi d’acqua e spiagge, presenza di inquinamento nell’aria, … – <strong>Accesso riservato</strong></li>\n </ul>\n \n <p>Se vuoi aderire alla rete puoi richiederne la registrazione utilizzando questo Link <a href=\"#\"><strong>(Pagina in Costruzione)</strong></a>.</p>\n\n",
|
"containerHtml": "<style>\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 20px;\n background-color: #f0f0f0;\n color: #333;\n}\n\nh1 {\n color: #0056b3;\n text-align: center;\n}\n\n\np, li {\n line-height: 1.6;\n}\n\n\nul {\n list-style-type: none;\n padding: 0;\n}\n\n\nli {\n background-color: #fff !important;\n margin-bottom: 10px !important;\n padding: 10px !important;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; \n}\n\n\na {\n color: #007bff;\n text-decoration: none;\n}\n\n\na:hover {\n text-decoration: underline;\n}\n\n\n.container {\n max-width: 800px;\n margin: 0 auto;\n background-color: #fff;\n padding: 20px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n}\n\n\n.strong {\n font-weight: bold;\n}\n</style>\n\n\n<p><strong>“Abitare gli Iblei”</strong> è una rete aperta che ha lo scopo di riunire tutte quelle persone che vogliono valorizzare e qualificare la vita nel territorio degli Iblei. </p>\n \n <p>Chi aderisce alla rete si riconosce in una <strong>Carta dei valori comuni</strong> e usa la rete per scambiare conoscenze, esperienze, risorse e prodotti sviluppati nell’ambito delle proprie iniziative (profit e non profit) individuali o collettive.</p>\n\n\n <p>L’area territoriale di questa rete è quella dei <strong>Monti Iblei orientali e occidentali</strong> (Noto, Avola, Canicattini, Siracusa, Palazzolo, Buccheri, Ferla, Modica, …).</p>\n\n\n <p>La rete <strong>“Abitare gli Iblei”</strong> offre i seguenti servizi utili per il territorio ed i suoi abitanti, frutto di una costruzione collettiva:</p>\n \n <ul>\n <li><strong>1. Mappa delle attività virtuose:</strong> permette di identificare attività pubbliche e private nel territorio che possono essere utili nella vita quotidiana. Queste attività possono riguardare artigiani, produttori o fornitori di servizi di cui almeno un membro della rete conosca la qualità e l’affidabilità (agricoltori, falegnami, fabbri, idraulici, imprese edili, strutture ricettive, …). Altre informazioni utili possono riguardare associazioni/istituzioni operanti in vari settori. – <strong>Accesso pubblico</strong></li>\n <li><strong>2. Calendario:</strong> permette di accedere ad annunci di eventi utili alla crescita culturale del territorio. La pubblicazione di eventi è riservata ai soli membri della rete che possono presentare iniziative anche di altri organizzatori. – <strong>Accesso pubblico</strong></li>\n <li><strong>3. Scambi di servizi, prodotti e ospitalità:</strong> questa funzione è riservata ai soli membri della rete e si realizza attraverso la Rete italiana di scambi orizzontali (RISO). – <strong>Accesso riservato</strong></li>\n <li><strong>4. Segnalazione di pericoli per il territorio:</strong> attraverso questa mappa è possibile segnalare incendi, immondizia abbandonata, discariche abusive, fonti di inquinamento per corsi d’acqua e spiagge, presenza di inquinamento nell’aria, … – <strong>Accesso riservato</strong></li>\n </ul>\n \n <p>Se vuoi aderire alla rete puoi richiederne la registrazione utilizzando questo Link <a href=\"#\"><strong>(Pagina in Costruzione)</strong></a>.</p>\n\n",
|
||||||
"anim": {
|
"anim": {
|
||||||
"_id": ObjectId("66db393e3b885ccdfaed28d6"),
|
"_id": new ObjectId("66db393e3b885ccdfaed28d6"),
|
||||||
"name": "",
|
"name": "",
|
||||||
"clduration": "",
|
"clduration": "",
|
||||||
"cldelay": "",
|
"cldelay": "",
|
||||||
@@ -76,7 +76,7 @@ db.myelems.insertMany([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
, {
|
, {
|
||||||
"_id": ObjectId("66e41cff78c8d880eebfbf1c"),
|
"_id": new ObjectId("66e41cff78c8d880eebfbf1c"),
|
||||||
"order": 32.5,
|
"order": 32.5,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 20,
|
"type": 20,
|
||||||
@@ -89,7 +89,7 @@ db.myelems.insertMany([
|
|||||||
"__v": 0,
|
"__v": 0,
|
||||||
"containerHtml": "ORAAAA",
|
"containerHtml": "ORAAAA",
|
||||||
"anim": {
|
"anim": {
|
||||||
"_id": ObjectId("66e459421e0719a1012123ad"),
|
"_id": new ObjectId("66e459421e0719a1012123ad"),
|
||||||
"name": "",
|
"name": "",
|
||||||
"clduration": "",
|
"clduration": "",
|
||||||
"cldelay": "",
|
"cldelay": "",
|
||||||
@@ -98,7 +98,7 @@ db.myelems.insertMany([
|
|||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66e4270d78c8d880eebfbf24"),
|
"_id": new ObjectId("66e4270d78c8d880eebfbf24"),
|
||||||
"order": 40,
|
"order": 40,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 20,
|
"type": 20,
|
||||||
@@ -111,14 +111,14 @@ db.myelems.insertMany([
|
|||||||
"__v": 0,
|
"__v": 0,
|
||||||
"containerHtml": "BBB",
|
"containerHtml": "BBB",
|
||||||
"anim": {
|
"anim": {
|
||||||
"_id": ObjectId("66e4568d1e0719a1012121a6"),
|
"_id": new ObjectId("66e4568d1e0719a1012121a6"),
|
||||||
"name": "",
|
"name": "",
|
||||||
"clduration": "",
|
"clduration": "",
|
||||||
"cldelay": "",
|
"cldelay": "",
|
||||||
"timingtype": "ease-in-out"
|
"timingtype": "ease-in-out"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"_id": ObjectId("66e45b0c78c8d880eebfbf45"),
|
"_id": new ObjectId("66e45b0c78c8d880eebfbf45"),
|
||||||
"order": 70,
|
"order": 70,
|
||||||
"active": true,
|
"active": true,
|
||||||
"type": 20,
|
"type": 20,
|
||||||
@@ -136,7 +136,7 @@ db.myelems.insertMany([
|
|||||||
db.sites.insert(
|
db.sites.insert(
|
||||||
/* 1 */
|
/* 1 */
|
||||||
{
|
{
|
||||||
"_id": ObjectId("669fbef7fc704b8912263af9"),
|
"_id": new ObjectId("669fbef7fc704b8912263af9"),
|
||||||
"confpages": {
|
"confpages": {
|
||||||
"font": "",
|
"font": "",
|
||||||
"col_toolbar": "",
|
"col_toolbar": "",
|
||||||
@@ -235,7 +235,7 @@ db.sites.insert(
|
|||||||
|
|
||||||
db.users.insert(
|
db.users.insert(
|
||||||
{
|
{
|
||||||
"_id": ObjectId("669fbef7c9d625d0628eb12d"),
|
"_id": new ObjectId("669fbef7c9d625d0628eb12d"),
|
||||||
"profile": {
|
"profile": {
|
||||||
"paymenttypes": [],
|
"paymenttypes": [],
|
||||||
"notif_idCities": [],
|
"notif_idCities": [],
|
||||||
@@ -343,7 +343,7 @@ db.users.insert(
|
|||||||
"tokens": [
|
"tokens": [
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
||||||
"_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
"_id": new ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
||||||
@@ -351,7 +351,7 @@ db.users.insert(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
||||||
"_id": ObjectId("66e73f04ac95a84fd0e122ae"),
|
"_id": new ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ db.mygroups.insert(
|
|||||||
"photos": [],
|
"photos": [],
|
||||||
"admins": [
|
"admins": [
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66e2e6276b502b07f1e89571"),
|
"_id": new ObjectId("66e2e6276b502b07f1e89571"),
|
||||||
"username": "paoloar77"
|
"username": "paoloar77"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
db.mypages.insertMany([
|
db.mypages.insertMany([
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66db21118009ea4503bb6a01"),
|
"_id": new ObjectId("66db21118009ea4503bb6a01"),
|
||||||
"order": 10,
|
"order": 10,
|
||||||
"idapp": "19",
|
"idapp": "19",
|
||||||
"path": "home",
|
"path": "home",
|
||||||
@@ -8,7 +8,7 @@ db.mypages.insertMany([
|
|||||||
"title": "Home",
|
"title": "Home",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66db21118009ea4503bb6a03"),
|
"_id": new ObjectId("66db21118009ea4503bb6a03"),
|
||||||
"order": 10,
|
"order": 10,
|
||||||
"idapp": "19",
|
"idapp": "19",
|
||||||
"path": "home_logout",
|
"path": "home_logout",
|
||||||
@@ -16,7 +16,7 @@ db.mypages.insertMany([
|
|||||||
"title": "Home NoLoggato",
|
"title": "Home NoLoggato",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66e322dd5a6360e3b3c71c5a"),
|
"_id": new ObjectId("66e322dd5a6360e3b3c71c5a"),
|
||||||
"order": 40,
|
"order": 40,
|
||||||
"idapp": "19",
|
"idapp": "19",
|
||||||
"path": "presentazione",
|
"path": "presentazione",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
db.users.insertMany([
|
db.users.insertMany([
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66db21115281b23462d496d2"),
|
"_id": new ObjectId("66db21115281b23462d496d2"),
|
||||||
"profile": {
|
"profile": {
|
||||||
"paymenttypes": [],
|
"paymenttypes": [],
|
||||||
"notif_idCities": [],
|
"notif_idCities": [],
|
||||||
@@ -66,7 +66,7 @@ db.users.insertMany([
|
|||||||
"tokens": [
|
"tokens": [
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3Mjc3MjI0NjV9.EOvF89kswT1eqVJCSwVMMI-jB4kokP-aQVhi7xSUods",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3Mjc3MjI0NjV9.EOvF89kswT1eqVJCSwVMMI-jB4kokP-aQVhi7xSUods",
|
||||||
"_id": ObjectId("66e87ee1bbe2ce0f77adf6b8"),
|
"_id": new ObjectId("66e87ee1bbe2ce0f77adf6b8"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3MjY1MjAwNjV9.ESvyTWmXhfAQ0i-wwjxZR1A1Y5Bwixb60uG_UcOPQ5Y",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3MjY1MjAwNjV9.ESvyTWmXhfAQ0i-wwjxZR1A1Y5Bwixb60uG_UcOPQ5Y",
|
||||||
@@ -90,7 +90,7 @@ db.users.insertMany([
|
|||||||
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
|
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66e49515d18d313a144ead56"),
|
"_id": new ObjectId("66e49515d18d313a144ead56"),
|
||||||
"profile": {
|
"profile": {
|
||||||
"paymenttypes": [],
|
"paymenttypes": [],
|
||||||
"notif_idCities": [],
|
"notif_idCities": [],
|
||||||
@@ -187,7 +187,7 @@ db.users.insertMany([
|
|||||||
"tokens": [
|
"tokens": [
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3Mjc1NTY5MTV9.NHnFUXOL0MbjRs9F6HrQsEBRGXG89AsBYP7jU9m8icY",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3Mjc1NTY5MTV9.NHnFUXOL0MbjRs9F6HrQsEBRGXG89AsBYP7jU9m8icY",
|
||||||
"_id": ObjectId("66e5f83392c9540e18f89730"),
|
"_id": new ObjectId("66e5f83392c9540e18f89730"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3MjYzNTQ1MTV9.HTr1kNMhBU_38R2Tfy6m22XCbiRh5IsBKC3fl0ipIgM",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3MjYzNTQ1MTV9.HTr1kNMhBU_38R2Tfy6m22XCbiRh5IsBKC3fl0ipIgM",
|
||||||
@@ -207,7 +207,7 @@ db.users.insertMany([
|
|||||||
"perm": 16
|
"perm": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"_id": ObjectId("66e6fb5aac95a84fd0e11881"),
|
"_id": new ObjectId("66e6fb5aac95a84fd0e11881"),
|
||||||
"profile": {
|
"profile": {
|
||||||
"paymenttypes": [],
|
"paymenttypes": [],
|
||||||
"notif_idCities": [],
|
"notif_idCities": [],
|
||||||
@@ -304,7 +304,7 @@ db.users.insertMany([
|
|||||||
"tokens": [
|
"tokens": [
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
||||||
"_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
"_id": new ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
||||||
@@ -312,7 +312,7 @@ db.users.insertMany([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
||||||
"_id": ObjectId("66e73f04ac95a84fd0e122ae"),
|
"_id": new ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||||
"access": "auth",
|
"access": "auth",
|
||||||
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ./.env.prod.pcb
|
|
||||||
|
|
||||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configurazione
|
|
||||||
REMOTE_USER="pcbuser"
|
|
||||||
REMOTE_HOST="pcb"
|
|
||||||
REMOTE_PORT="8822"
|
|
||||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
|
||||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
|
||||||
|
|
||||||
# Array di cartelle e file da sincronizzare
|
|
||||||
SYNC_ITEMS=(
|
|
||||||
"css"
|
|
||||||
"docs"
|
|
||||||
"emails"
|
|
||||||
"plugins"
|
|
||||||
"admin_scripts"
|
|
||||||
"sass"
|
|
||||||
"src"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo $REMOTE_DIR
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia Cartelle ... "
|
|
||||||
|
|
||||||
|
|
||||||
# Esegui rsync per le cartelle
|
|
||||||
rsync -avz --delete \
|
|
||||||
--exclude='src/server/router/upload/' \
|
|
||||||
-e "ssh $SSH_OPTIONS" \
|
|
||||||
"${SYNC_ITEMS[@]}" \
|
|
||||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file .env.production ... "
|
|
||||||
|
|
||||||
# Sincronizza i file specifici
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
.env.prod.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.production"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file package.json ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file ecosystem.config.js ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
ecosystem.config.pcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
|
||||||
|
|
||||||
# Verifica il risultato
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Sincronizzazione completata con successo. SERVER PCB! "
|
|
||||||
else
|
|
||||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ./.env.test.pcb
|
|
||||||
|
|
||||||
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configurazione
|
|
||||||
REMOTE_USER="pcbuser"
|
|
||||||
REMOTE_HOST="pcb"
|
|
||||||
REMOTE_PORT="8822"
|
|
||||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
|
||||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
|
||||||
|
|
||||||
# Array di cartelle e file da sincronizzare
|
|
||||||
SYNC_ITEMS=(
|
|
||||||
"css"
|
|
||||||
"docs"
|
|
||||||
"emails"
|
|
||||||
"plugins"
|
|
||||||
"admin_scripts"
|
|
||||||
"sass"
|
|
||||||
"src"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo $REMOTE_DIR
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia Cartelle ... "
|
|
||||||
|
|
||||||
|
|
||||||
# Esegui rsync per le cartelle
|
|
||||||
rsync -avz --delete \
|
|
||||||
--exclude='src/server/router/upload/' \
|
|
||||||
-e "ssh $SSH_OPTIONS" \
|
|
||||||
"${SYNC_ITEMS[@]}" \
|
|
||||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file .env.test ... "
|
|
||||||
|
|
||||||
# Sincronizza i file specifici
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
.env.test.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.test"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file package.json ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file ecosystem.config.testpcb.js in ecosystem.config.js ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
ecosystem.config.testpcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
|
||||||
|
|
||||||
# Verifica il risultato
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Sincronizzazione completata con successo. SERVER PCB TEST! "
|
|
||||||
else
|
|
||||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
|
||||||
fi
|
|
||||||
|
|
||||||
76
deploynode_pcb_prod.sh
Executable file
76
deploynode_pcb_prod.sh
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.prod.pcb
|
||||||
|
|
||||||
|
|
||||||
|
msg="*** SERVER DI ### PRODUZIONE ### PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
read -p "$msg" risposta
|
||||||
|
else
|
||||||
|
echo $msg
|
||||||
|
risposta=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="pcbuser"
|
||||||
|
REMOTE_HOST="pcb"
|
||||||
|
REMOTE_PORT="8822"
|
||||||
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"admin_scripts"
|
||||||
|
"sass"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo $REMOTE_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia Cartelle ... "
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file .env.production ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
.env.prod.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.production"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
ecosystem.config.pcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Sincronizzazione completata con successo. SERVER PCB! "
|
||||||
|
else
|
||||||
|
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
87
deploynode_pcb_test.sh
Executable file
87
deploynode_pcb_test.sh
Executable file
@@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.test.pcb
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
msg="*** SERVER DI TEST PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
read -p "$msg" risposta
|
||||||
|
else
|
||||||
|
echo $msg
|
||||||
|
risposta=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="pcbuser"
|
||||||
|
REMOTE_HOST="pcb"
|
||||||
|
REMOTE_PORT="8822"
|
||||||
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
|
||||||
|
CONFIG_JS="ecosystem.config.testriso.js"
|
||||||
|
ENV_FILE=".env.test.risosrv"
|
||||||
|
ENV_OUT=".env.test"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"admin_scripts"
|
||||||
|
"sass"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo $REMOTE_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia Cartelle ... "
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file .env.test ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||||
|
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.testpcb.js in ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
ecosystem.config.testpcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Sincronizzazione completata con successo. SERVER PCB TEST! "
|
||||||
|
else
|
||||||
|
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
80
deploynode_riso_prod.sh
Executable file
80
deploynode_riso_prod.sh
Executable file
@@ -0,0 +1,80 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.prod.riso
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
msg="*** SERVER DI ### PRODUZIONE ### RISO **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
read -p "$msg" risposta
|
||||||
|
else
|
||||||
|
echo $msg
|
||||||
|
risposta=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="pcbuser"
|
||||||
|
REMOTE_HOST="pcb"
|
||||||
|
REMOTE_PORT="8822"
|
||||||
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
CONFIG_JS="ecosystem.config.prod_riso.js"
|
||||||
|
ENV_FILE=".env.prod.riso"
|
||||||
|
ENV_OUT=".env.production"
|
||||||
|
|
||||||
|
#ENV_FILE=".env.prod.pcb"
|
||||||
|
#ENV_OUT=".env.production"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"sass"
|
||||||
|
"admin_scripts"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo $REMOTE_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia Cartelle ... "
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "✅ Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||||
|
else
|
||||||
|
echo "❌ Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
86
deploynode_riso_test.sh
Executable file
86
deploynode_riso_test.sh
Executable file
@@ -0,0 +1,86 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.test.risosrv
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
msg="*** SERVER DI ### TEST ### RISO **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
read -p "$msg" risposta
|
||||||
|
else
|
||||||
|
echo $msg
|
||||||
|
risposta=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="pcbuser"
|
||||||
|
REMOTE_HOST="pcb"
|
||||||
|
REMOTE_PORT="8822"
|
||||||
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
CONFIG_JS="ecosystem.config.testriso.js"
|
||||||
|
ENV_FILE=".env.test.risosrv"
|
||||||
|
ENV_OUT=".env.test"
|
||||||
|
|
||||||
|
#ENV_FILE=".env.prod.pcb"
|
||||||
|
#ENV_OUT=".env.production"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"sass"
|
||||||
|
"admin_scripts"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo $REMOTE_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia Cartelle ... "
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||||
|
else
|
||||||
|
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ./.env.prod.riso
|
|
||||||
|
|
||||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configurazione
|
|
||||||
REMOTE_USER="pcbuser"
|
|
||||||
REMOTE_HOST="pcb"
|
|
||||||
REMOTE_PORT="8822"
|
|
||||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
|
||||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
|
||||||
CONFIG_JS="ecosystem.config.prod_riso.js"
|
|
||||||
ENV_FILE=".env.prod.riso"
|
|
||||||
ENV_OUT=".env.production"
|
|
||||||
|
|
||||||
#ENV_FILE=".env.prod.pcb"
|
|
||||||
#ENV_OUT=".env.production"
|
|
||||||
|
|
||||||
# Array di cartelle e file da sincronizzare
|
|
||||||
SYNC_ITEMS=(
|
|
||||||
"css"
|
|
||||||
"docs"
|
|
||||||
"emails"
|
|
||||||
"plugins"
|
|
||||||
"sass"
|
|
||||||
"admin_scripts"
|
|
||||||
"src"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo $REMOTE_DIR
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia Cartelle ... "
|
|
||||||
|
|
||||||
|
|
||||||
# Esegui rsync per le cartelle
|
|
||||||
rsync -avz --delete \
|
|
||||||
--exclude='src/server/router/upload/' \
|
|
||||||
-e "ssh $SSH_OPTIONS" \
|
|
||||||
"${SYNC_ITEMS[@]}" \
|
|
||||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
|
||||||
|
|
||||||
# Sincronizza i file specifici
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file package.json ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file ecosystem.config.js ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
|
||||||
|
|
||||||
# Verifica il risultato
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "✅ Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
|
||||||
else
|
|
||||||
echo "❌ Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ./.env.test2
|
|
||||||
|
|
||||||
echo "Directory attuale: $PWD"
|
|
||||||
|
|
||||||
msg="*** SERVER DI TEST2 **** SEI SICURO DI INVIARE GLI AGGIORNAMENTI SERVERSIDE (NODE JS) - SUL SERVER $SERVERDIR_WEBSITE (Y/N) ? "
|
|
||||||
|
|
||||||
if [ "$1" = "" ]; then
|
|
||||||
read -p "$msg" risposta
|
|
||||||
else
|
|
||||||
echo $msg
|
|
||||||
risposta=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
|
||||||
|
|
||||||
echo "Sincronizzazione in corso... $SERVERDIR_WEBSITE"
|
|
||||||
echo "Copiando .env.test2..."
|
|
||||||
rsync -avz -e 'ssh -p 8855' .env.test2 suryapaolo@servereng:$SERVERDIR_WEBSITE/.env.test
|
|
||||||
echo "Sincronizzazione in corso... src"
|
|
||||||
rsync -avz -e 'ssh -p 8855' -a --exclude 'src/router/upload' src suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' package.json suryapaolo@servereng:$SERVERDIR_WEBSITE/package.json
|
|
||||||
rsync -avz -e 'ssh -p 8855' css suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' docs suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' emails suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' images suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' plugins suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
rsync -avz -e 'ssh -p 8855' sass suryapaolo@servereng:$SERVERDIR_WEBSITE/
|
|
||||||
|
|
||||||
echo "Sincronizzazione TERMINATA! - SERVER TEST2!"
|
|
||||||
fi
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source ./.env.test.risosrv
|
|
||||||
|
|
||||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Configurazione
|
|
||||||
REMOTE_USER="pcbuser"
|
|
||||||
REMOTE_HOST="pcb"
|
|
||||||
REMOTE_PORT="8822"
|
|
||||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
|
||||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
|
||||||
CONFIG_JS="ecosystem.config.testriso.js"
|
|
||||||
ENV_FILE=".env.test.risosrv"
|
|
||||||
ENV_OUT=".env.test"
|
|
||||||
|
|
||||||
#ENV_FILE=".env.prod.pcb"
|
|
||||||
#ENV_OUT=".env.production"
|
|
||||||
|
|
||||||
# Array di cartelle e file da sincronizzare
|
|
||||||
SYNC_ITEMS=(
|
|
||||||
"css"
|
|
||||||
"docs"
|
|
||||||
"emails"
|
|
||||||
"plugins"
|
|
||||||
"sass"
|
|
||||||
"admin_scripts"
|
|
||||||
"src"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo $REMOTE_DIR
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia Cartelle ... "
|
|
||||||
|
|
||||||
|
|
||||||
# Esegui rsync per le cartelle
|
|
||||||
rsync -avz --delete \
|
|
||||||
--exclude='src/server/router/upload/' \
|
|
||||||
-e "ssh $SSH_OPTIONS" \
|
|
||||||
"${SYNC_ITEMS[@]}" \
|
|
||||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
|
||||||
|
|
||||||
# Sincronizza i file specifici
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file package.json ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Copia del file ecosystem.config.js ... "
|
|
||||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
|
||||||
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
|
||||||
|
|
||||||
# Verifica il risultato
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
|
||||||
else
|
|
||||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ module.exports = {
|
|||||||
name: "FreePlanetServerSide",
|
name: "FreePlanetServerSide",
|
||||||
script: "./src/server/server.js",
|
script: "./src/server/server.js",
|
||||||
ignore_watch : ["node_modules"],
|
ignore_watch : ["node_modules"],
|
||||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
|
||||||
watch: false,
|
watch: false,
|
||||||
//autorestart: true,
|
//autorestart: true,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: "PRODUZIONE PiuCheBuono_ServerSide",
|
name: "PiuCheBuono",
|
||||||
script: "/var/www/nodejs_piuchebuono_server/src/server/server.js",
|
script: "/var/www/nodejs_piuchebuono_server/src/server/server.js",
|
||||||
ignore_watch: ["node_modules", "logs"],
|
ignore_watch: ["node_modules", "logs"],
|
||||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
|
||||||
//autorestart: true,
|
//autorestart: true,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
watch: false,
|
watch: false,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: "PRODUZIONE RISO - FREEPLANET",
|
name: "RISO",
|
||||||
script: "/var/www/nodejs_riso_server/src/server/server.js",
|
script: "/var/www/nodejs_riso_server/src/server/server.js",
|
||||||
ignore_watch: ["node_modules", "logs"],
|
ignore_watch: ["node_modules", "logs"],
|
||||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||||
//autorestart: true,
|
//autorestart: true,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
watch: false,
|
watch: false,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: "TEST PiuCheBuono_ServerSide",
|
name: "PiuCheBuono (TEST)",
|
||||||
script: "/var/www/nodejs_test.piuchebuono_server/src/server/server.js",
|
script: "/var/www/nodejs_test.piuchebuono_server/src/server/server.js",
|
||||||
ignore_watch: ["node_modules", "logs"],
|
ignore_watch: ["node_modules", "logs"],
|
||||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||||
//autorestart: true,
|
//autorestart: true,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
watch: false,
|
watch: false,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: "TESTRISO2 FreePlanetServerSide",
|
name: "RISO (TEST)",
|
||||||
script: "./src/server/server.js",
|
script: "./src/server/server.js",
|
||||||
ignore_watch: ["node_modules", "logs"],
|
ignore_watch: ["node_modules", "logs"],
|
||||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||||
watch: false,
|
watch: false,
|
||||||
//autorestart: true,
|
//autorestart: true,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
|
|||||||
BIN
emails/.DS_Store
vendored
BIN
emails/.DS_Store
vendored
Binary file not shown.
6
filelog.txt
Normal file
6
filelog.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
Dom 02/03 ORE 16:32: USER [surya1977]: ciao
|
||||||
|
|
||||||
|
Lun 10/03 ORE 15:52: USER [surya1977]: ciao
|
||||||
|
|
||||||
|
Lun 10/03 ORE 15:56: USER [surya1977]: ciao
|
||||||
20
logtrans.txt
20
logtrans.txt
@@ -419,3 +419,23 @@ Gio 09/01 ORE 17:04: [<b>Circuito RIS TerraNFT</b>]: Inviate Monete da terranft
|
|||||||
Saldi:
|
Saldi:
|
||||||
terranft (paoloar77): -30.00 RIS]
|
terranft (paoloar77): -30.00 RIS]
|
||||||
SuryaArena: 30.00 RIS]
|
SuryaArena: 30.00 RIS]
|
||||||
|
Ven 28/02 ORE 19:40: [<b>Circuito RIS Bologna</b>]: Inviate Monete da surya1977 a SuryaSecondo 2 RIS [causale: aaa]
|
||||||
|
|
||||||
|
Saldi:
|
||||||
|
surya1977: 33.90 RIS]
|
||||||
|
SuryaSecondo: 2.10 RIS]
|
||||||
|
Lun 03/03 ORE 00:38: [<b>Circuito RIS Bologna</b>]: Inviate Monete da surya1977 a SuryaSecondo 3 RIS [causale: ]
|
||||||
|
|
||||||
|
Saldi:
|
||||||
|
surya1977: 30.90 RIS]
|
||||||
|
SuryaSecondo: 5.10 RIS]
|
||||||
|
Lun 03/03 ORE 00:40: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a Giovannifruttadisicilia 5.4 RIS [causale: aranceee !!]
|
||||||
|
|
||||||
|
Saldi:
|
||||||
|
surya1977: 62.55 RIS]
|
||||||
|
Giovannifruttadisicilia: 362.40 RIS]
|
||||||
|
Lun 03/03 ORE 01:06: [<b>Circuito RIS Arezzo</b>]: Inviate Monete da surya1977 a Andro 1 RIS [causale: test]
|
||||||
|
|
||||||
|
Saldi:
|
||||||
|
surya1977: -1.10 RIS]
|
||||||
|
Andro: 1.00 RIS]
|
||||||
89
package.json
89
package.json
@@ -13,78 +13,75 @@
|
|||||||
"starttest": "NODE_ENV=test node src/server/server.js",
|
"starttest": "NODE_ENV=test node src/server/server.js",
|
||||||
"test-watch": "nodemon --exec 'npm test'"
|
"test-watch": "nodemon --exec 'npm test'"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "^18.19.0"
|
|
||||||
},
|
|
||||||
"author": "Surya",
|
"author": "Surya",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"basic-ftp": "^5.0.2",
|
"basic-ftp": "^5.0.5",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^3.0.2",
|
||||||
"bluebird": "^3.7.2",
|
"bluebird": "^3.7.2",
|
||||||
"body-parser": "^1.20.0",
|
"body-parser": "^1.20.3",
|
||||||
"cookie-parser": "^1.4.6",
|
"cookie-parser": "^1.4.7",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"country-codes-list": "^1.6.8",
|
"country-codes-list": "^2.0.0",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.2.0",
|
||||||
"csurf": "^1.11.0",
|
"csurf": "^1.11.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.10",
|
||||||
"email-templates": "^10.0.1",
|
"email-templates": "^12.0.2",
|
||||||
"express": "^4.18.1",
|
"express": "^4.21.2",
|
||||||
"formidable": "^2.0.1",
|
"formidable": "^3.5.2",
|
||||||
"ghostscript4js": "^3.2.3",
|
"ghostscript4js": "^3.2.3",
|
||||||
"i18n": "^0.15.0",
|
"i18n": "^0.15.1",
|
||||||
"image-downloader": "^4.3.0",
|
"image-downloader": "^4.3.0",
|
||||||
"internet-available": "^1.0.0",
|
"internet-available": "^1.0.0",
|
||||||
"jade": "^1.9.2",
|
"jade": "^1.11.0",
|
||||||
"jsdom": "^24.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"jsonwebtoken": "^9.0.1",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mongodb": "^4.4.1",
|
"mongodb": "^6.14.2",
|
||||||
"mongoose": "^5.13.15",
|
"mongoose": "^8.12.1",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"node-cron": "^3.0.2",
|
"node-cron": "^3.0.3",
|
||||||
"node-emoji": "^1.11.0",
|
"node-emoji": "^2.2.0",
|
||||||
"node-image-resizer": "^1.0.0",
|
"node-image-resizer": "^1.0.0",
|
||||||
"node-pre-gyp": "^0.14.0",
|
"node-pre-gyp": "^0.17.0",
|
||||||
"node-pty": "^1.0.0",
|
"node-pty": "^1.0.0",
|
||||||
"node-telegram-bot-api": "^0.65.1",
|
"node-telegram-bot-api": "^0.66.0",
|
||||||
"nodemailer": "^6.7.8",
|
"nodemailer": "^6.10.0",
|
||||||
"npm-check-updates": "^16.14.18",
|
"npm-check-updates": "^17.1.15",
|
||||||
"openai": "^4.83.0",
|
"openai": "^4.86.2",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"pdf-parse": "^1.1.1",
|
"pdf-parse": "^1.1.1",
|
||||||
"pem": "^1.14.6",
|
"pem": "^1.14.8",
|
||||||
"preview-email": "^3.0.7",
|
"preview-email": "^3.1.0",
|
||||||
"pug": "^3.0.2",
|
"pug": "^3.0.3",
|
||||||
"rate-limiter-flexible": "^2.3.9",
|
"rate-limiter-flexible": "^5.0.5",
|
||||||
"request": "^2.34",
|
"request": "^2.88",
|
||||||
"sanitize-html": "^2.13.0",
|
"sanitize-html": "^2.14.0",
|
||||||
"save": "^2.5.0",
|
"save": "^2.9.0",
|
||||||
"sharp": "^0.30.7",
|
"sharp": "^0.33.5",
|
||||||
"superagent": "^8.0.0",
|
"superagent": "^10.1.1",
|
||||||
"tedious": "^18.6.1",
|
"tedious": "^18.6.1",
|
||||||
"url-parse": "^1.5.10",
|
"url-parse": "^1.5.10",
|
||||||
"validator": "^13.7.0",
|
"validator": "^13.12.0",
|
||||||
"vhost": "^3.0.2",
|
"vhost": "^3.0.2",
|
||||||
"web-push": "^3.6.7",
|
"web-push": "^3.6.7",
|
||||||
"xml2js": "^0.6.2",
|
"xml2js": "^0.6.2",
|
||||||
"xoauth2": "^1.2.0"
|
"xoauth2": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browser-sync": "^2.27.10",
|
"browser-sync": "^3.0.3",
|
||||||
"expect": "^29.0.2",
|
"expect": "^29.7.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^5.0.0",
|
||||||
"gulp-inline-css": "^2.0.0",
|
"gulp-inline-css": "^4.0.0",
|
||||||
"gulp-pug": "^5.0.0",
|
"gulp-pug": "^5.0.0",
|
||||||
"gulp-rename": "^2.0.0",
|
"gulp-rename": "^2.0.0",
|
||||||
"gulp-replace": "^1.1.3",
|
"gulp-replace": "^1.1.4",
|
||||||
"gulp-sass": "^5.1.0",
|
"gulp-sass": "^6.0.1",
|
||||||
"jest": "^29.0.2",
|
"jest": "^29.7.0",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^11.1.0",
|
||||||
"nodemon": "^3.0.1",
|
"nodemon": "^3.1.9",
|
||||||
"supertest": "^6.2.4"
|
"supertest": "^7.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
53
scripts/esporta_dati.sh
Normal file
53
scripts/esporta_dati.sh
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Definizione delle costanti
|
||||||
|
targetDB="FreePlanet"
|
||||||
|
MYDOCKER="mongodb_riso"
|
||||||
|
|
||||||
|
# Percorso del file da Esportare (specificare il percorso completo)
|
||||||
|
myCollection="$1"
|
||||||
|
fileToImport="$1.json"
|
||||||
|
|
||||||
|
# Leggi il nome della collezione come primo argomento
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Errore: Devi specificare il nome della collezione come argomento."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Leggi le credenziali dal file di configurazione
|
||||||
|
source ~/batch/.my_cfg.ini
|
||||||
|
|
||||||
|
# Verifica che le variabili siano state impostate correttamente
|
||||||
|
if [ -z "$PWDDB" ]; then
|
||||||
|
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Messaggio di conferma
|
||||||
|
echo "Stai per Esportare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
|
||||||
|
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
|
||||||
|
|
||||||
|
# Controllo della risposta dell'utente
|
||||||
|
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
|
||||||
|
echo "Operazione annullata."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Esegui il comando mongoimport dentro il container Docker
|
||||||
|
docker exec $MYDOCKER mongoexport \
|
||||||
|
--username admin \
|
||||||
|
--password "$PWDDB" \
|
||||||
|
--authenticationDatabase admin \
|
||||||
|
--db "$targetDB" \
|
||||||
|
--collection "$myCollection" \
|
||||||
|
--out "$fileToImport" \
|
||||||
|
|
||||||
|
|
||||||
|
# Verifica lo stato dell'operazione
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Esportazione completata con successo! $fileToImport"
|
||||||
|
else
|
||||||
|
echo "Errore durante l'esportazione."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
53
scripts/importa_dati.sh
Normal file
53
scripts/importa_dati.sh
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Definizione delle costanti
|
||||||
|
targetDB="FreePlanet"
|
||||||
|
MYDOCKER="mongodb_riso"
|
||||||
|
|
||||||
|
# Percorso del file da importare (specificare il percorso completo)
|
||||||
|
myCollection="$1"
|
||||||
|
fileToImport="$1.json"
|
||||||
|
|
||||||
|
# Leggi il nome della collezione come primo argomento
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Errore: Devi specificare il nome della collezione come argomento."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Leggi le credenziali dal file di configurazione
|
||||||
|
source ~/batch/.my_cfg.ini
|
||||||
|
|
||||||
|
# Verifica che le variabili siano state impostate correttamente
|
||||||
|
if [ -z "$PWDDB" ]; then
|
||||||
|
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Messaggio di conferma
|
||||||
|
echo "Stai per importare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
|
||||||
|
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
|
||||||
|
|
||||||
|
# Controllo della risposta dell'utente
|
||||||
|
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
|
||||||
|
echo "Operazione annullata."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Esegui il comando mongoimport dentro il container Docker
|
||||||
|
docker exec $MYDOCKER mongoimport \
|
||||||
|
--username admin \
|
||||||
|
--password "$PWDDB" \
|
||||||
|
--authenticationDatabase admin \
|
||||||
|
--db "$targetDB" \
|
||||||
|
--collection "$myCollection" \
|
||||||
|
--file "$fileToImport" \
|
||||||
|
--jsonArray
|
||||||
|
|
||||||
|
# Verifica lo stato dell'operazione
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Importazione completata con successo!"
|
||||||
|
else
|
||||||
|
echo "Errore durante l'importazione."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"folders": [
|
|
||||||
{
|
|
||||||
"path": "../.."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../newfreeplanet"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "../../../cnm"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"settings": {
|
|
||||||
"search.useIgnoreFiles": false,
|
|
||||||
"search.useParentIgnoreFiles": false,
|
|
||||||
"files.exclude": {
|
|
||||||
"": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,28 @@
|
|||||||
const tools = require('../tools/general');
|
const tools = require('../tools/general');
|
||||||
|
|
||||||
|
console.log('__');
|
||||||
|
console.log('__');
|
||||||
|
console.log('__');
|
||||||
|
console.log('__');
|
||||||
|
console.log('****************************************************');
|
||||||
|
console.log('*** AVVIO DEL SERVER NODE.JS ***');
|
||||||
|
console.log('****************************************************');
|
||||||
|
console.log('__');
|
||||||
|
|
||||||
|
if ((process.env.NODE_ENV === 'production')) {
|
||||||
|
console.log(' *** AMBIENTE DI PRODUZIONE !!!!')
|
||||||
|
} else if (process.env.NODE_ENV === 'test') {
|
||||||
|
console.log(' *** ### AMBIENTE DI TEST ')
|
||||||
|
} else if (process.env.NODE_ENV === 'development') {
|
||||||
|
console.log(' *** ### AMBIENTE DI SVILUPPO (LOCALE) ')
|
||||||
|
}
|
||||||
|
console.log('__');
|
||||||
|
|
||||||
// still in app.js
|
// still in app.js
|
||||||
const node_env = process.env.NODE_ENV || 'production';
|
const node_env = process.env.NODE_ENV || 'production';
|
||||||
console.log('node_env=', node_env);
|
|
||||||
|
|
||||||
var file = `.env.${node_env}`;
|
var file = `.env.${node_env}`;
|
||||||
|
|
||||||
|
|
||||||
// GLOBALI (Uguali per TUTTI)
|
// GLOBALI (Uguali per TUTTI)
|
||||||
process.env.LINKVERIF_REG = '/vreg';
|
process.env.LINKVERIF_REG = '/vreg';
|
||||||
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
|
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
|
||||||
@@ -22,466 +38,16 @@ require('dotenv').config({ path: file });
|
|||||||
process.env.DATABASE = process.env.DATABASE || 'FreePlanet';
|
process.env.DATABASE = process.env.DATABASE || 'FreePlanet';
|
||||||
|
|
||||||
console.log('process.env.DOMAIN:', process.env.DOMAIN);
|
console.log('process.env.DOMAIN:', process.env.DOMAIN);
|
||||||
process.env.MONGODB_URI = process.env.DOMAIN + process.env.DATABASE;
|
const domain = process.env.DOMAIN;
|
||||||
console.log('process.env.MONGODB_URI:', process.env.MONGODB_URI);
|
const username = encodeURIComponent(process.env.MONGODB_USER);
|
||||||
|
const password = encodeURIComponent(process.env.MONGODB_PWD);
|
||||||
|
const database = process.env.DATABASE || "test"; // Nome del database, default a 'test'
|
||||||
|
|
||||||
|
if (process.env.AUTH_DB_PASSING === "1") {
|
||||||
|
// replace username and password in the process.env.DOMAIN
|
||||||
/*
|
process.env.MONGODB_URI = process.env.DOMAIN_AUTH.replace('{username}', username).replace('{password}', password) + database;
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
// ---------------- AMBIENTE DI PRODUZIONE !!!!!!!!!! --------------------
|
|
||||||
MYAPPS = [
|
|
||||||
{
|
|
||||||
idapp: '1',
|
|
||||||
name: 'FreePlanet',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'paolo.arena77@gmail.com',
|
|
||||||
host: 'https://freeplanet.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/www.freeplanet.app',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '2',
|
|
||||||
name: 'Associazione Shen',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: 'info@associazioneshen.it',
|
|
||||||
replyTo: 'info@associazioneshen.it',
|
|
||||||
host: 'https://www.associazioneshen.it',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/associazioneshen.it',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '3',
|
|
||||||
name: 'Brigitte MG Dumont',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'http://brigittemgdumont.com',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '4',
|
|
||||||
name: 'Mandala Solidale',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://mandala.freeplanet.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/mandala.freeplanet.app',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '6',
|
|
||||||
name: 'Mandala per l\'Anima',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'http://mandalaperlanima.eu',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '8',
|
|
||||||
name: 'CentrOlistico Rimini',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'info@arcodiluce.it',
|
|
||||||
host: 'https://www.centrolisticorimini.it',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/centrolisticorimini.it',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '9',
|
|
||||||
name: 'SalviamoIlPianeta',
|
|
||||||
adminemail: 'salviamoilpianeta2020@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://salviamoilpianeta.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/salviamoilpianeta.app',
|
|
||||||
email_from: 'salviamoilpianeta2020@gmail.com',
|
|
||||||
email_pwd: 'c6f63e7aba9393c73f56e338a7fe5283a73949363662d26bd375dd05b6f6f37ebkw4vINQ0O/4d8JN71aNH3UsyndeFRgyyMvJMVl4iOk=',
|
|
||||||
telegram_key:'1202788747:AAErwzIsD7k-3Yj5AX6ci3p7ELMuyASq4vA',
|
|
||||||
telegram_bot_name: 'SalviamoIlPianeta_bot',
|
|
||||||
pathreg_add:'_sip',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '10',
|
|
||||||
name: 'Comunità Nuovo Mondo',
|
|
||||||
adminemail: 'cnmrimini@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://comunitanuovomondo.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/comunitanuovomondo.app',
|
|
||||||
// email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
// email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
email_from: 'cnmrimini@gmail.com',
|
|
||||||
email_pwd: '9693e200ae56f1119185a29d34079656a628f2663dc108f7d106496ac0042815F+mvJF79KcQcUnF0twoyIg==',
|
|
||||||
telegram_key:'1646348227:AAF2qgpHB4KprhB0HPefazGLyoVGW_i4jTA',
|
|
||||||
telegram_bot_name: 'cnm_mybot',
|
|
||||||
pathreg_add:'_cnm',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '11',
|
|
||||||
name: 'ArtEnergetica',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://www.artenergetica.org',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
} else if (process.env.NODE_ENV === 'test') {
|
|
||||||
// ---------------- AMBIENTE DI TEST --------------------
|
|
||||||
MYAPPS = [
|
|
||||||
{
|
|
||||||
idapp: '1',
|
|
||||||
name: 'FreePlanet',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'paolo.arena77@gmail.com',
|
|
||||||
host: 'https://test.freeplanet.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/www.freeplanet.app',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '2',
|
|
||||||
name: 'Associazione Shen',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'info@associazioneshen.it',
|
|
||||||
host: 'http://test.associazioneshen.it',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/associazioneshen.it',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '3',
|
|
||||||
name: 'Brigitte MG Dumont',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://test.brigittemgdumont.com',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '4',
|
|
||||||
name: 'Mandala Solidale',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'https://mandala.freeplanet.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/mandalatest.freeplanet.app',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '6',
|
|
||||||
name: 'Mandala per l\'Anima',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://test.mandalaperlanima.eu',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '8',
|
|
||||||
name: 'CentrOlistico Rimini',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'info@arcodiluce.it',
|
|
||||||
host: 'https://www.centrolisticorimini.it',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/centrolisticorimini.it',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '9',
|
|
||||||
name: 'SalviamoIlPianeta (Server Test)',
|
|
||||||
adminemail: 'info.pianetalibero@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://test.salviamoilpianeta.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/test.salviamoilpianeta.app',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'_sip',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '10',
|
|
||||||
name: 'Comunità Nuovo Mondo (Server Test)',
|
|
||||||
adminemail: 'info.pianetalibero@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: '',
|
|
||||||
host: 'https://test.comunitanuovomondo.app',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/test.comunitanuovomondo.app',
|
|
||||||
// email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
// email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'_cnm',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '3',
|
|
||||||
name: 'Brigitte MG Dumont',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://test.brigittemgdumont.com',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '11',
|
|
||||||
name: 'ArtEnergetica',
|
|
||||||
adminemail: '',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'https://www.artenergetica.org',
|
|
||||||
portapp: '0',
|
|
||||||
dir: '/var/www/artenergetica.org',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
} else {
|
} else {
|
||||||
// ---------------- AMBIENTE IN L O C A L E --------------------
|
process.env.MONGODB_URI = domain + database;
|
||||||
MYAPPS = [
|
|
||||||
{
|
|
||||||
idapp: '1',
|
|
||||||
name: 'FreePlanet',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'paolo.arena77@gmail.com',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8080',
|
|
||||||
dir: '/home/paolo/myproject/freeplanet/dist/spa',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '2',
|
|
||||||
name: 'Associazione Shen',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'info@associazioneshen.it',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8081',
|
|
||||||
dir: '/home/paolo/myproject/associazioneShen/dist/spa',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '3',
|
|
||||||
name: 'Brigitte',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8082',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '4',
|
|
||||||
name: 'Mandala Solidale',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8084',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '6',
|
|
||||||
name: 'Mandala per l\'Anima',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8083',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '8',
|
|
||||||
name: 'CentrOlistico Rimini',
|
|
||||||
adminemail: 'pao.loarena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
replyTo: 'info@arcodiluce.it',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8086',
|
|
||||||
dir: '/home/paolo/myproject/centrolisticorimini.it/dist/spa',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key:'',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '9',
|
|
||||||
name: 'SalviamoIlPianeta',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8087',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
telegram_key: '',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
|
|
||||||
// telegram_key:'1049833543:AAE1RhGUJVdm0N_vrj0ijHZ04GCkKjl8TuQ',
|
|
||||||
// telegram_bot_name: 'TestSalviamoIlPianeta_bot',
|
|
||||||
pathreg_add:'_sip',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '10',
|
|
||||||
name: 'Comunità Nuovo Mondo',
|
|
||||||
adminemail: 'cnmrimini@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8090',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'cnmrimini@gmail.com',
|
|
||||||
email_pwd: 'bc61ab32a09d22e3a5097aa6668d3c724854c5856de9c713c427017bb89cdb0ctIESmuHr3FCNTLlRAK6d5Q',
|
|
||||||
telegram_key: '',
|
|
||||||
telegram_bot_name: '',
|
|
||||||
pathreg_add:'_cnm',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
idapp: '11',
|
|
||||||
name: 'ArtEnergetica',
|
|
||||||
adminemail: 'paolo.arena77@gmail.com',
|
|
||||||
manageremail: '',
|
|
||||||
host: 'http://localhost',
|
|
||||||
portapp: '8091',
|
|
||||||
dir: '',
|
|
||||||
email_from: 'info.pianetalibero@gmail.com',
|
|
||||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
|
||||||
pathreg_add:'',
|
|
||||||
abilitanave: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
console.log('process.env.MONGODB_URI:', process.env.MONGODB_URI);
|
||||||
|
|
||||||
|
|||||||
@@ -1,75 +1,84 @@
|
|||||||
var mongoose = require('mongoose').set('debug', false)
|
var mongoose = require('mongoose').set('debug', process.env.VITE_DEBUG);
|
||||||
|
|
||||||
|
// Configurazione globale di Mongoose
|
||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
|
|
||||||
mongoose.level = "";
|
mongoose.level = "";
|
||||||
|
|
||||||
|
|
||||||
mongoose.plugin(schema => {
|
|
||||||
schema.options.usePushEach = true
|
|
||||||
});
|
|
||||||
|
|
||||||
mongoose.set('debug', false);
|
mongoose.set('debug', false);
|
||||||
|
mongoose.set('strictQuery', false);
|
||||||
|
|
||||||
|
// Opzioni di connessione
|
||||||
let options = {
|
let options = {
|
||||||
// user: process.env.UDB,
|
maxPoolSize: 5,
|
||||||
// pass: process.env.PDB,
|
// useNewUrlParser: true,
|
||||||
// useMongoClient: true,
|
// useUnifiedTopology: true,
|
||||||
// useMongoClient: false,
|
serverSelectionTimeoutMS: 20000, // Timeout di 30 secondi per la selezione del server
|
||||||
useNewUrlParser: true,
|
|
||||||
// useFindAndModify: true,
|
|
||||||
useFindAndModify: false,
|
|
||||||
// useCreateIndex: true,
|
|
||||||
useUnifiedTopology: true,
|
|
||||||
|
|
||||||
promiseLibrary: require('bluebird'),
|
|
||||||
|
|
||||||
// autoIndex: false, // Don't build indexes
|
|
||||||
// reconnectTries: Number.MAX_VALUE, // Never stop trying to reconnect
|
|
||||||
// reconnectInterval: 500, // Reconnect every 500ms
|
|
||||||
// poolSize: 10, // Maintain up to 10 socket connections
|
|
||||||
// // If not connected, return errors immediately rather than waiting for reconnect
|
|
||||||
// bufferMaxEntries: 0,
|
|
||||||
// connectTimeoutMS: 10000, // Give up initial connection after 10 seconds
|
|
||||||
// socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity
|
|
||||||
// family: 4 // Use IPv4, skip trying IPv6
|
|
||||||
|
|
||||||
// keepAlive: true, // keepAlive is true by default since mongoose 5.2.0
|
|
||||||
// keepAliveInitialDelay: 300000 // keepAliveInitialDelay is the number of milliseconds to wait before initiating keepAlive on the socket.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Controllo dell'autenticazione
|
||||||
console.log('process.env.AUTH_MONGODB', process.env.AUTH_MONGODB);
|
console.log('process.env.AUTH_MONGODB', process.env.AUTH_MONGODB);
|
||||||
|
|
||||||
|
const username = encodeURIComponent(process.env.MONGODB_USER);
|
||||||
|
const password = encodeURIComponent(process.env.MONGODB_PWD);
|
||||||
|
|
||||||
|
|
||||||
if (process.env.AUTH_MONGODB === '1') {
|
if (process.env.AUTH_MONGODB === '1') {
|
||||||
options.auth = {
|
options.auth = {
|
||||||
authSource: "admin",
|
authSource: "admin",
|
||||||
poolSize: 10,
|
username,
|
||||||
user: process.env.MONGODB_USER,
|
password
|
||||||
password: process.env.MONGODB_PWD,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.auth && options.auth.user) {
|
if (options.auth && options.auth.username) {
|
||||||
console.log('MongoDb con Authenticazione:', options.auth.user, '******');
|
console.log('MongoDb con Authenticazione:', options.auth.username, '******');
|
||||||
} else {
|
} else {
|
||||||
console.log('### MongoDb SENZA Authenticazione !!! ');
|
console.log('### MongoDb SENZA Authenticazione !!! ');
|
||||||
}
|
}
|
||||||
|
|
||||||
const db = mongoose.connection;
|
// Stampa delle informazioni di sistema
|
||||||
|
|
||||||
console.log('Node Version ' + process.version);
|
console.log('Node Version ' + process.version);
|
||||||
console.log('Mongoose Version ' + mongoose.version);
|
console.log('Mongoose Version ' + mongoose.version);
|
||||||
|
|
||||||
connectionUrl = process.env.MONGODB_URI;
|
// URL di connessione
|
||||||
|
const connectionUrl = process.env.MONGODB_URI;
|
||||||
console.log('Connessione a ' + connectionUrl + ' in corso...');
|
console.log('Connessione a ' + connectionUrl + ' in corso...');
|
||||||
mongoose.connect(connectionUrl, options);
|
|
||||||
|
|
||||||
db.on('error', console.error.bind(console, 'connection error:'));
|
// Funzione per connettersi al database con retry
|
||||||
db.once('open', function () {
|
async function connectToDatabase(uri, opts) {
|
||||||
// we're connected!
|
let isConnected = false;
|
||||||
console.log('*** CONNESSIONE EFFETTUATA ! ' + connectionUrl + ' db: ' + process.env.DATABASE)
|
|
||||||
|
|
||||||
});
|
while (!isConnected) {
|
||||||
|
try {
|
||||||
|
console.log("Sto provando a connettermi al database...");
|
||||||
|
await mongoose.connect(uri);
|
||||||
|
|
||||||
module.exports = { mongoose };
|
console.log(' *** CONNESSIONE EFFETTUATA ! ' + uri + ' db: ' + process.env.DATABASE);
|
||||||
|
|
||||||
|
console.log(' Database corrente:', mongoose.connection.name);
|
||||||
|
|
||||||
|
// Ottieni l'URL completo della connessione
|
||||||
|
console.log(' URL di connessione:', mongoose.connection.client.s.url);
|
||||||
|
|
||||||
|
const db = mongoose.connection;
|
||||||
|
const serverInfo = await db.db.admin().serverStatus(); // Ottieni lo stato del server
|
||||||
|
console.log(` Versione di MongoDB: ${serverInfo.version}`); // Stampa la versione
|
||||||
|
|
||||||
|
isConnected = true; // Imposta la flag di connessione a true
|
||||||
|
} catch (error) {
|
||||||
|
console.error(" Errore durante la connessione al database:", error.message);
|
||||||
|
|
||||||
|
// if (error.name === 'MongooseServerSelectionError' || error.name === 'MongoServerError') {
|
||||||
|
console.log(" Ritento la connessione tra 1 minuto...");
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 60000)); // Attendi 1 minuto prima di ritentare
|
||||||
|
/*} else {
|
||||||
|
console.error(" Errore irreversibile. Arresto il processo.");
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 10000)); // Attendi 1 minuto prima di ritentare
|
||||||
|
process.exit(1); // Termina il processo in caso di errore irreversibile
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Esporta Mongoose
|
||||||
|
module.exports = { mongoose, connectToDatabase, connectionUrl, options };
|
||||||
@@ -30,7 +30,9 @@ const authenticate = (req, res, next) => {
|
|||||||
|
|
||||||
const access = 'auth';
|
const access = 'auth';
|
||||||
|
|
||||||
return User.findByToken(token, access, true).then((ris) => {
|
const idapp = getIdApp(req);
|
||||||
|
|
||||||
|
return User.findByToken(token, access, true, idapp).then((ris) => {
|
||||||
|
|
||||||
if (ris && ris.user && !!ris.user.deleted) {
|
if (ris && ris.user && !!ris.user.deleted) {
|
||||||
if (ris.user.deleted)
|
if (ris.user.deleted)
|
||||||
@@ -70,43 +72,61 @@ const authenticate = (req, res, next) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getIdApp = (req) => {
|
||||||
|
let idapp = null;
|
||||||
|
try {
|
||||||
|
idapp = req.query.idapp;
|
||||||
|
} catch (e) {
|
||||||
|
console.log('IDAPP NON TROVATO !');
|
||||||
|
}
|
||||||
|
return idapp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const authenticate_noerror = (req, res, next) => {
|
const authenticate_noerror = (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const token = req.header('x-auth');
|
const token = req.header('x-auth');
|
||||||
const refreshToken = req.header('x-refrtok');
|
const refreshToken = req.header('x-refrtok');
|
||||||
|
|
||||||
const access = 'auth';
|
if (!token) {
|
||||||
|
|
||||||
return User.findByToken(token, access, false).then((ris) => {
|
|
||||||
if (ris.code !== server_constants.RIS_CODE_OK) {
|
|
||||||
req.user = null;
|
|
||||||
req.token = null;
|
|
||||||
req.access = null;
|
|
||||||
req.code = ris.code;
|
|
||||||
} else {
|
|
||||||
req.user = ris.user;
|
|
||||||
req.token = token;
|
|
||||||
req.refreshToken = refreshToken;
|
|
||||||
req.access = access;
|
|
||||||
req.code = ris.code;
|
|
||||||
}
|
|
||||||
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
|
||||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
|
||||||
} else {
|
|
||||||
// Vai avanti ad eseguire il codice, in ogni modo !
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}).catch((e) => {
|
|
||||||
req.user = null;
|
req.user = null;
|
||||||
req.token = null;
|
req.token = null;
|
||||||
req.access = null;
|
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
req.code = 0;
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
// Continua comunque !
|
User.findByToken(token, 'auth', false, getIdApp(req))
|
||||||
next();
|
.then((ris) => {
|
||||||
});
|
if (ris.code !== server_constants.RIS_CODE_OK) {
|
||||||
|
req.user = null;
|
||||||
|
req.token = null;
|
||||||
|
req.code = ris.code;
|
||||||
|
} else {
|
||||||
|
req.user = ris.user;
|
||||||
|
req.token = token;
|
||||||
|
req.refreshToken = refreshToken;
|
||||||
|
req.code = ris.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||||
|
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.error('Errore durante l\'autenticazione:', e);
|
||||||
|
req.user = null;
|
||||||
|
req.token = null;
|
||||||
|
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
|
next();
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Err', e);
|
console.error('Errore nel middleware di autenticazione:', e);
|
||||||
|
req.user = null;
|
||||||
|
req.token = null;
|
||||||
|
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -98,9 +98,7 @@ AccountSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp, deleted: false };
|
const myfind = { idapp, deleted: false };
|
||||||
|
|
||||||
return await Account.find(myfind, (err, arrrec) => {
|
return await Account.find(myfind).lean();
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AccountSchema.pre('save', async function (next) {
|
AccountSchema.pre('save', async function (next) {
|
||||||
@@ -764,8 +762,8 @@ AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp
|
|||||||
|
|
||||||
const Account = mongoose.model('Account', AccountSchema);
|
const Account = mongoose.model('Account', AccountSchema);
|
||||||
|
|
||||||
Account.createIndexes((err) => {
|
Account.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
module.exports = { Account };
|
module.exports = { Account };
|
||||||
|
|||||||
@@ -42,13 +42,7 @@ AdTypeSchema.pre('save', async function (next) {
|
|||||||
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
|
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
|
||||||
const AdType = this;
|
const AdType = this;
|
||||||
|
|
||||||
const query = [
|
return AdType.find({}).sort({_id: 1}).lean();
|
||||||
{$sort: {_id: 1}},
|
|
||||||
];
|
|
||||||
|
|
||||||
return await AdType.aggregate(query).then((arrrec) => {
|
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,8 +58,9 @@ AdTypeSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
const AdType = mongoose.model('AdType', AdTypeSchema);
|
const AdType = mongoose.model('AdType', AdTypeSchema);
|
||||||
|
|
||||||
AdType.createIndexes((err) => {
|
AdType.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = {AdType};
|
module.exports = {AdType};
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ AdTypeGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema);
|
const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema);
|
||||||
|
|
||||||
AdTypeGood.createIndexes((err) => {
|
AdTypeGood.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = {AdTypeGood};
|
module.exports = {AdTypeGood};
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ const AttivitaSchema = new Schema(
|
|||||||
...tools.getFieldsForAnnunci()
|
...tools.getFieldsForAnnunci()
|
||||||
}, { strict: false });
|
}, { strict: false });
|
||||||
|
|
||||||
AttivitaSchema.index({ 'idapp': 1 });
|
|
||||||
|
|
||||||
|
|
||||||
AttivitaSchema.pre('save', async function (next) {
|
AttivitaSchema.pre('save', async function (next) {
|
||||||
@@ -390,8 +389,9 @@ AttivitaSchema.statics.getCompleteRecord = function (idapp, id) {
|
|||||||
|
|
||||||
const Attivita = mongoose.model('Attivita', AttivitaSchema);
|
const Attivita = mongoose.model('Attivita', AttivitaSchema);
|
||||||
|
|
||||||
Attivita.createIndexes((err) => {
|
Attivita.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Attivita };
|
module.exports = { Attivita };
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
return await Author.find(myfind).sort({name: 1, surname: 1});
|
return await Author.find(myfind).sort({name: 1, surname: 1});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -68,10 +68,7 @@ bookingSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp, sall) {
|
|||||||
else
|
else
|
||||||
myfind = { userId, idapp, booked: true };
|
myfind = { userId, idapp, booked: true };
|
||||||
|
|
||||||
return Booking.find(myfind, (err, arrbooked) => {
|
return Booking.find(myfind).lean();
|
||||||
// console.log('ris Booking:', arrbooked);
|
|
||||||
return arrbooked
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +91,7 @@ function getUsersByBooking(idapp) {
|
|||||||
$Lookup: {
|
$Lookup: {
|
||||||
from: "users",
|
from: "users",
|
||||||
localField: "userId", // field in my collection
|
localField: "userId", // field in my collection
|
||||||
foreignField: "ObjectId(_id)", // field in the 'from' collection
|
foreignField: "new ObjectId(_id)", // field in the 'from' collection
|
||||||
as: "fromItems"
|
as: "fromItems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -122,8 +119,9 @@ bookingSchema.statics.findAllDistinctByBooking = function (idapp) {
|
|||||||
|
|
||||||
const Booking = mongoose.model('Booking', bookingSchema);
|
const Booking = mongoose.model('Booking', bookingSchema);
|
||||||
|
|
||||||
Booking.createIndexes((err) => {
|
Booking.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Booking };
|
module.exports = { Booking };
|
||||||
|
|||||||
@@ -205,8 +205,9 @@ BotSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const MyBot = mongoose.model('Bot', BotSchema);
|
const MyBot = mongoose.model('Bot', BotSchema);
|
||||||
|
|
||||||
MyBot.createIndexes((err) => {
|
MyBot.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyBot };
|
module.exports = { MyBot };
|
||||||
|
|||||||
@@ -76,8 +76,9 @@ CalZoomSchema.statics.getNextZoom = async function (idapp) {
|
|||||||
|
|
||||||
const CalZoom = mongoose.model('CalZoom', CalZoomSchema);
|
const CalZoom = mongoose.model('CalZoom', CalZoomSchema);
|
||||||
|
|
||||||
CalZoom.createIndexes((err) => {
|
CalZoom.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { CalZoom };
|
module.exports = { CalZoom };
|
||||||
|
|||||||
@@ -89,15 +89,17 @@ module.exports.getCartByUserId = async function (uid, idapp) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.updateCartByUserId = function (userId, newCart, callback) {
|
module.exports.updateCartByUserId = async function (userId, newCart) {
|
||||||
let query = { userId: userId };
|
const query = { userId: userId };
|
||||||
Cart.find(query, function (err, c) {
|
|
||||||
if (err) throw err;
|
|
||||||
|
|
||||||
//exist cart in databse
|
try {
|
||||||
if (c.length > 0) {
|
// Cerca il carrello esistente nel database
|
||||||
Cart.findOneAndUpdate(
|
const existingCart = await Cart.findOne(query);
|
||||||
{ userId: userId },
|
|
||||||
|
if (existingCart) {
|
||||||
|
// Se il carrello esiste, aggiorna i dati
|
||||||
|
const updatedCart = await Cart.findOneAndUpdate(
|
||||||
|
query,
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
items: newCart.items,
|
items: newCart.items,
|
||||||
@@ -107,14 +109,21 @@ module.exports.updateCartByUserId = function (userId, newCart, callback) {
|
|||||||
userId: userId,
|
userId: userId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ new: true },
|
{ new: true } // Restituisce il documento aggiornato
|
||||||
callback,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return updatedCart; // Restituisce il carrello aggiornato
|
||||||
} else {
|
} else {
|
||||||
//no cart in database
|
// Se il carrello non esiste, crea un nuovo documento
|
||||||
newCart.save(callback);
|
const createdCart = new Cart(newCart);
|
||||||
|
const savedCart = await createdCart.save();
|
||||||
|
return savedCart; // Restituisce il carrello creato
|
||||||
}
|
}
|
||||||
});
|
} catch (err) {
|
||||||
|
// Gestione degli errori
|
||||||
|
console.error("Errore durante l'aggiornamento del carrello:", err);
|
||||||
|
throw err; // Propaga l'errore al chiamante
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.updateCartByCartId = async function (cartId, newCart) {
|
module.exports.updateCartByCartId = async function (cartId, newCart) {
|
||||||
@@ -148,7 +157,7 @@ module.exports.updateCartByCartId = async function (cartId, newCart) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.deleteCartByCartId = async function (cartId) {
|
module.exports.deleteCartByCartId = async function (cartId) {
|
||||||
return await Cart.remove({ _id: cartId });
|
return await Cart.deleteOne({ _id: cartId });
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createCart = async function (newCart) {
|
module.exports.createCart = async function (newCart) {
|
||||||
@@ -156,6 +165,7 @@ module.exports.createCart = async function (newCart) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Cart.createIndexes((err) => {
|
Cart.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,10 @@ const CashCategorySchema = new Schema({
|
|||||||
|
|
||||||
var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema);
|
var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema);
|
||||||
|
|
||||||
CashCategory.createIndexes((err) => {
|
CashCategory.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports.getFieldsForSearch = function () {
|
module.exports.getFieldsForSearch = function () {
|
||||||
return []
|
return []
|
||||||
@@ -44,7 +45,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CashCategory.find(myfind);
|
return await CashCategory.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllCashCategory = function (query, sort, callback) {
|
module.exports.getAllCashCategory = function (query, sort, callback) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CashSubCategory.find(myfind);
|
return await CashSubCategory.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
||||||
@@ -70,6 +70,7 @@ module.exports.createCashSubCategory = async function (CashSubCategory) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -49,13 +49,14 @@ CatAISchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CatAISchema.statics.findAllIdApp = async function (idapp) {
|
CatAISchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CatAI.find(myfind).sort({ name: 1 });
|
return await CatAI.find(myfind).sort({ name: 1 }).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
const CatAI = mongoose.model('CatAI', CatAISchema);
|
const CatAI = mongoose.model('CatAI', CatAISchema);
|
||||||
|
|
||||||
CatAI.createIndexes((err) => {
|
CatAI.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = CatAI;
|
module.exports = CatAI;
|
||||||
|
|||||||
@@ -121,8 +121,9 @@ CatalogSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const Catalog = mongoose.model('Catalog', CatalogSchema);
|
const Catalog = mongoose.model('Catalog', CatalogSchema);
|
||||||
|
|
||||||
Catalog.createIndexes((err) => {
|
Catalog.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Catalog };
|
module.exports = { Catalog };
|
||||||
|
|||||||
@@ -45,14 +45,15 @@ CategorySchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CategorySchema.statics.findAllIdApp = async function (idapp) {
|
CategorySchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Category.find(myfind);
|
return await Category.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
const Category = mongoose.model('Category', CategorySchema);
|
const Category = mongoose.model('Category', CategorySchema);
|
||||||
|
|
||||||
Category.createIndexes((err) => {
|
Category.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Category };
|
module.exports = { Category };
|
||||||
|
|||||||
@@ -80,8 +80,9 @@ CatGrpSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
|
|
||||||
const CatGrp = mongoose.model('CatGrp', CatGrpSchema);
|
const CatGrp = mongoose.model('CatGrp', CatGrpSchema);
|
||||||
|
|
||||||
CatGrp.createIndexes((err) => {
|
CatGrp.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { CatGrp };
|
module.exports = { CatGrp };
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ CatProdSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
CatProdSchema.statics.findAllIdApp = async function (idapp) {
|
CatProdSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await CatProd.find(myfind).sort({ name: 1 });
|
return await CatProd.find(myfind).sort({ name: 1 }).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
|
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
|
||||||
@@ -90,9 +90,10 @@ CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
|
|||||||
|
|
||||||
const CatProd = mongoose.model('CatProd', CatProdSchema);
|
const CatProd = mongoose.model('CatProd', CatProdSchema);
|
||||||
|
|
||||||
CatProd.createIndexes((err) => {
|
CatProd.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = CatProd;
|
module.exports = CatProd;
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ CfgServerSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
|
|
||||||
const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
|
const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
|
||||||
|
|
||||||
CfgServer.createIndexes((err) => {
|
CfgServer.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = {CfgServer};
|
module.exports = {CfgServer};
|
||||||
|
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const whatToShow = this.getWhatToShow(idapp, '');
|
const whatToShow = this.getWhatToShow(idapp, '');
|
||||||
|
|
||||||
return await Circuit.find(myfind, whatToShow).lean().sort({ name: 1 });
|
return await Circuit.find(myfind, whatToShow).sort({ name: 1 }).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||||
@@ -607,7 +607,7 @@ CircuitSchema.statics.getCircuitById = async function (circuitId) {
|
|||||||
|
|
||||||
CircuitSchema.statics.deleteCircuit = async function (idapp, usernameOrig, name) {
|
CircuitSchema.statics.deleteCircuit = async function (idapp, usernameOrig, name) {
|
||||||
console.log('Circuito ' + name + ' rimosso da ' + usernameOrig);
|
console.log('Circuito ' + name + ' rimosso da ' + usernameOrig);
|
||||||
return await Circuit.findOneAndRemove({ idapp, name });
|
return await Circuit.findOneAndDelete({ idapp, name });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1796,8 +1796,9 @@ CircuitSchema.statics.addMovementByOrdersCart = async function (ordersCart, user
|
|||||||
|
|
||||||
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
||||||
|
|
||||||
Circuit.createIndexes((err) => {
|
Circuit.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Circuit };
|
module.exports = { Circuit };
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
|
|||||||
CitySchema.statics.findAllIdApp = async function (idapp) {
|
CitySchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = {};
|
const myfind = {};
|
||||||
|
|
||||||
return await City.find(myfind);
|
return await City.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
|
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
|
||||||
@@ -274,8 +274,9 @@ CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
|
|||||||
|
|
||||||
const City = mongoose.model('City', CitySchema);
|
const City = mongoose.model('City', CitySchema);
|
||||||
|
|
||||||
City.createIndexes((err) => {
|
City.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { City };
|
module.exports = { City };
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
return await Collana.find(myfind).sort({title: 1}).lean();
|
return await Collana.find(myfind).sort({title: 1}).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -47,15 +47,14 @@ ContribtypeSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Contribtype.find(myfind, (err, arrrec) => {
|
return await Contribtype.find(myfind).lean();
|
||||||
return arrrec
|
|
||||||
}).lean();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Contribtype = mongoose.model('Contribtype', ContribtypeSchema);
|
const Contribtype = mongoose.model('Contribtype', ContribtypeSchema);
|
||||||
|
|
||||||
Contribtype.createIndexes((err) => {
|
Contribtype.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Contribtype };
|
module.exports = { Contribtype };
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ const departmentSchema = new Schema({
|
|||||||
|
|
||||||
var Department = module.exports = mongoose.model('Department', departmentSchema);
|
var Department = module.exports = mongoose.model('Department', departmentSchema);
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports.getFieldsForSearch = function () {
|
module.exports.getFieldsForSearch = function () {
|
||||||
return [{ field: 'name', type: tools.FieldType.string },
|
return [{ field: 'name', type: tools.FieldType.string },
|
||||||
@@ -44,6 +45,6 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Department.find(myfind);
|
return await Department.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,9 @@ DisciplineSchema.statics.DuplicateAllRecords = async function (idapporig, idappd
|
|||||||
|
|
||||||
const Discipline = mongoose.model('Discipline', DisciplineSchema);
|
const Discipline = mongoose.model('Discipline', DisciplineSchema);
|
||||||
|
|
||||||
Discipline.createIndexes((err) => {
|
Discipline.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Discipline };
|
module.exports = { Discipline };
|
||||||
|
|||||||
@@ -228,9 +228,8 @@ ExtraListSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await ExtraList.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ExtraListSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
|
ExtraListSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
|
||||||
@@ -332,9 +331,10 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
|
|||||||
|
|
||||||
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
|
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
|
||||||
|
|
||||||
ExtraList.createIndexes((err) => {
|
ExtraList.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { ExtraList };
|
module.exports = { ExtraList };
|
||||||
|
|
||||||
|
|||||||
@@ -57,15 +57,14 @@ GallerySchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Gallery.find(myfind, (err, arrrec) => {
|
return await Gallery.find(myfind).lean();
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Gallery = mongoose.model('Gallery', GallerySchema);
|
const Gallery = mongoose.model('Gallery', GallerySchema);
|
||||||
|
|
||||||
Gallery.createIndexes((err) => {
|
Gallery.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Gallery };
|
module.exports = { Gallery };
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ module.exports.getGasordineByID = function (id, callback) {
|
|||||||
Gasordine.findById(id, callback);
|
Gasordine.findById(id, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,9 @@ GoodSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
|
|
||||||
const Good = mongoose.model('Good', GoodSchema);
|
const Good = mongoose.model('Good', GoodSchema);
|
||||||
|
|
||||||
Good.createIndexes((err) => {
|
Good.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Good };
|
module.exports = { Good };
|
||||||
|
|||||||
@@ -312,9 +312,7 @@ GraduatoriaSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Graduatoria.find(myfind, (err, arrrec) => {
|
return await Graduatoria.find(myfind).lean();
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GraduatoriaSchema.statics.isWorking = function (idapp) {
|
GraduatoriaSchema.statics.isWorking = function (idapp) {
|
||||||
@@ -415,8 +413,9 @@ GraduatoriaSchema.statics.getPosizioneInGraduatoria = async function (idapp, ind
|
|||||||
|
|
||||||
const Graduatoria = mongoose.model('Graduatoria', GraduatoriaSchema);
|
const Graduatoria = mongoose.model('Graduatoria', GraduatoriaSchema);
|
||||||
|
|
||||||
Graduatoria.createIndexes((err) => {
|
Graduatoria.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Graduatoria };
|
module.exports = { Graduatoria };
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Group.find(myfind);
|
return await Group.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ module.exports.calculateHoursTodo = async function (idtodo) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp, deleted: false };
|
const myfind = { idapp, deleted: false };
|
||||||
|
|
||||||
return await ImportaDescr.find(myfind, (err, arrrec) => {
|
try {
|
||||||
return arrrec;
|
return await ImportaDescr.find(myfind).lean();
|
||||||
});
|
} catch (err) {
|
||||||
|
console.error("Errore in ImportaDescr:", err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -57,7 +57,10 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp, deleted: false };
|
const myfind = { idapp, deleted: false };
|
||||||
|
|
||||||
return await ImportaIsbn.find(myfind, (err, arrrec) => {
|
try {
|
||||||
return arrrec;
|
return await ImportaIsbn.find(myfind).lean();
|
||||||
});
|
} catch (err) {
|
||||||
|
console.error("Errore in ImportaIsbn:", err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -57,7 +57,12 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp, deleted: false };
|
const myfind = { idapp, deleted: false };
|
||||||
|
|
||||||
return await ImportaMacro.find(myfind, (err, arrrec) => {
|
|
||||||
return arrrec;
|
try {
|
||||||
});
|
return await ImportaMacro.find(myfind).lean();
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Errore in ImportaMacro:", err);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -53,7 +53,6 @@ module.exports.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp, deleted: false };
|
const myfind = { idapp, deleted: false };
|
||||||
|
|
||||||
return await Inventariogm.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(Inventariogm, myfind);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
@@ -192,11 +192,10 @@ module.exports.findAllIdApp = async function(idapp) {
|
|||||||
|
|
||||||
const myfind = {idapp};
|
const myfind = {idapp};
|
||||||
|
|
||||||
return await IscrittiArcadei.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -189,14 +189,12 @@ module.exports.findByEmail = function (idapp, email) {
|
|||||||
|
|
||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
|
|
||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await IscrittiConacreis.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ LevelSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
{$sort: {_id: 1}},
|
{$sort: {_id: 1}},
|
||||||
];
|
];
|
||||||
|
|
||||||
return await Level.aggregate(query).then((arrrec) => {
|
return Level.aggregate(query);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,8 +71,9 @@ LevelSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
const Level = mongoose.model('Level', LevelSchema);
|
const Level = mongoose.model('Level', LevelSchema);
|
||||||
|
|
||||||
Level.createIndexes((err) => {
|
Level.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = {Level};
|
module.exports = {Level};
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
|
|||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||||
|
|
||||||
return User.find(myfind, (err, arrrec) => {
|
return tools.findAllQueryIdApp(User, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MailingListSchema.statics.getnumSent = async function (idapp, idUser) {
|
MailingListSchema.statics.getnumSent = async function (idapp, idUser) {
|
||||||
@@ -62,12 +60,9 @@ MailingListSchema.statics.isOk = async function (idapp, iduser, idUser) {
|
|||||||
|
|
||||||
MailingListSchema.statics.findAllIdApp = async function (idapp) {
|
MailingListSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
|
|
||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await User.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(User, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) {
|
MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) {
|
||||||
@@ -84,15 +79,14 @@ MailingListSchema.statics.findByHash = function (idapp, hash) {
|
|||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||||
|
|
||||||
return User.findOne(myfind, (err, rec) => {
|
return User.findOne(myfind).lean();
|
||||||
return rec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const MailingList = mongoose.model('MailingList', MailingListSchema);
|
const MailingList = mongoose.model('MailingList', MailingListSchema);
|
||||||
|
|
||||||
User.createIndexes((err) => {
|
User.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MailingList };
|
module.exports = { MailingList };
|
||||||
|
|||||||
@@ -72,9 +72,8 @@ MovementSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await MyMovement.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(MyMovement, myfind);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MovementSchema.pre('save', async function (next) {
|
MovementSchema.pre('save', async function (next) {
|
||||||
@@ -1069,8 +1068,9 @@ MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz
|
|||||||
|
|
||||||
const Movement = mongoose.model('Movement', MovementSchema);
|
const Movement = mongoose.model('Movement', MovementSchema);
|
||||||
|
|
||||||
Movement.createIndexes((err) => {
|
Movement.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Movement };
|
module.exports = { Movement };
|
||||||
|
|||||||
@@ -118,15 +118,15 @@ MsgTemplateSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await MsgTemplate.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const MsgTemplate = mongoose.model('MsgTemplate', MsgTemplateSchema);
|
const MsgTemplate = mongoose.model('MsgTemplate', MsgTemplateSchema);
|
||||||
|
|
||||||
MsgTemplate.createIndexes((err) => {
|
MsgTemplate.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MsgTemplate };
|
module.exports = { MsgTemplate };
|
||||||
|
|||||||
@@ -143,9 +143,7 @@ MyBachecaSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
{ $sort: { descr: 1 } },
|
{ $sort: { descr: 1 } },
|
||||||
];
|
];
|
||||||
|
|
||||||
return await MyBacheca.aggregate(query).then((arrrec) => {
|
return await MyBacheca.aggregate(query);
|
||||||
return arrrec;
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -383,8 +381,9 @@ MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
|
|||||||
|
|
||||||
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
|
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
|
||||||
|
|
||||||
MyBacheca.createIndexes((err) => {
|
MyBacheca.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyBacheca };
|
module.exports = { MyBacheca };
|
||||||
|
|||||||
@@ -532,8 +532,9 @@ MyElemSchema.statics.getNewFreeNameTemplate = async function (idapp, idPageOrig,
|
|||||||
|
|
||||||
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
||||||
|
|
||||||
MyElem.createIndexes((err) => {
|
MyElem.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyElem };
|
module.exports = { MyElem };
|
||||||
|
|||||||
@@ -276,8 +276,9 @@ if (tools.INITDB_FIRSTIME) {
|
|||||||
|
|
||||||
const MyEvent = mongoose.model('MyEvent', MyEventSchema);
|
const MyEvent = mongoose.model('MyEvent', MyEventSchema);
|
||||||
|
|
||||||
MyEvent.createIndexes((err) => {
|
MyEvent.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = {MyEvent};
|
module.exports = {MyEvent};
|
||||||
|
|||||||
@@ -367,8 +367,9 @@ MyGoodSchema.statics.getProject = function () {
|
|||||||
|
|
||||||
const MyGood = mongoose.model('MyGood', MyGoodSchema);
|
const MyGood = mongoose.model('MyGood', MyGoodSchema);
|
||||||
|
|
||||||
MyGood.createIndexes((err) => {
|
MyGood.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyGood };
|
module.exports = { MyGood };
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ MyGroupSchema.pre('save', async function (next) {
|
|||||||
MyGroupSchema.statics.findAllIdApp = async function (idapp) {
|
MyGroupSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await MyGroup.find(myfind);
|
return await MyGroup.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
||||||
@@ -378,7 +378,7 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function (idapp, groupname
|
|||||||
|
|
||||||
MyGroupSchema.statics.deleteGroup = async function (idapp, usernameOrig, groupname) {
|
MyGroupSchema.statics.deleteGroup = async function (idapp, usernameOrig, groupname) {
|
||||||
console.log('Gruppo ' + groupname + ' rimosso da ' + usernameOrig);
|
console.log('Gruppo ' + groupname + ' rimosso da ' + usernameOrig);
|
||||||
return await MyGroup.findOneAndRemove({ idapp, groupname });
|
return await MyGroup.findOneAndDelete({ idapp, groupname });
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.statics.getGroupsByUsername = async function (idapp, username, req) {
|
MyGroupSchema.statics.getGroupsByUsername = async function (idapp, username, req) {
|
||||||
@@ -674,8 +674,9 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
|
|||||||
|
|
||||||
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
||||||
|
|
||||||
MyGroup.createIndexes((err) => {
|
MyGroup.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyGroup };
|
module.exports = { MyGroup };
|
||||||
|
|||||||
@@ -347,17 +347,16 @@ MyHospSchema.statics.getCompleteRecord = function (idapp, id) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MyHospSchema.statics.SettaAdTypeOffro_In_Hosps = function () {
|
MyHospSchema.statics.SettaAdTypeOffro_In_Hosps = async function () {
|
||||||
const MyHosp = this;
|
const MyHosp = this;
|
||||||
|
|
||||||
// Set all records 'adType' to shared_consts.AdType.OFFRO
|
try {
|
||||||
MyHosp.updateMany({}, { $set: { adType: shared_consts.AdType.OFFRO } }, function (err, result) {
|
// Set all records 'adType' to shared_consts.AdType.OFFRO
|
||||||
if (err) {
|
const result = await MyHosp.updateMany({}, { $set: { adType: shared_consts.AdType.OFFRO } });
|
||||||
console.error('Error updating adType:', err);
|
console.log('Successfully updated adType for', result.nModified, 'records');
|
||||||
} else {
|
} catch (err) {
|
||||||
console.log('Successfully updated adType for', result.nModified, 'records');
|
console.error('Error updating adType:', err);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MyHospSchema.statics.getProject = function () {
|
MyHospSchema.statics.getProject = function () {
|
||||||
@@ -383,8 +382,9 @@ MyHospSchema.statics.getProject = function () {
|
|||||||
|
|
||||||
const MyHosp = mongoose.model('MyHosp', MyHospSchema);
|
const MyHosp = mongoose.model('MyHosp', MyHospSchema);
|
||||||
|
|
||||||
MyHosp.createIndexes((err) => {
|
MyHosp.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyHosp };
|
module.exports = { MyHosp };
|
||||||
|
|||||||
@@ -164,9 +164,13 @@ MyPageSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await MyPage.find(myfind, (err, arrrec) => {
|
try {
|
||||||
return arrrec
|
return await MyPage.find(myfind).sort({ title: 1 }).lean();
|
||||||
}).sort({ title: 1 }).lean();
|
} catch (err) {
|
||||||
|
console.error("Errore in MyPage:", err, model);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
||||||
@@ -176,10 +180,7 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
|||||||
{
|
{
|
||||||
idapp,
|
idapp,
|
||||||
loadFirst: true,
|
loadFirst: true,
|
||||||
},
|
}).lean();
|
||||||
(err, arrrec) => {
|
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
|
|
||||||
const arrfixed = await MyPage.find(
|
const arrfixed = await MyPage.find(
|
||||||
{
|
{
|
||||||
@@ -206,9 +207,7 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
|||||||
loadFirst: 1,
|
loadFirst: 1,
|
||||||
mainMenu: 1,
|
mainMenu: 1,
|
||||||
sottoMenu: 1,
|
sottoMenu: 1,
|
||||||
}, (err, arrrec) => {
|
}).lean();
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
|
|
||||||
return [...arrFirst, ...arrfixed];
|
return [...arrFirst, ...arrfixed];
|
||||||
|
|
||||||
@@ -217,25 +216,32 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
|
|||||||
MyPageSchema.statics.findInternalPages = async function (idapp) {
|
MyPageSchema.statics.findInternalPages = async function (idapp) {
|
||||||
const MyPage = this;
|
const MyPage = this;
|
||||||
|
|
||||||
const myfind = {
|
try {
|
||||||
idapp,
|
const myfind = {
|
||||||
internalpage: { $exists: true, $eq: true }
|
idapp,
|
||||||
};
|
internalpage: { $exists: true, $eq: true }
|
||||||
|
};
|
||||||
|
|
||||||
return await MyPage.find(myfind, {
|
const result = await MyPage.find(myfind, {
|
||||||
title: 1,
|
title: 1,
|
||||||
path: 1,
|
path: 1,
|
||||||
onlyif_logged: 1,
|
onlyif_logged: 1,
|
||||||
only_residenti: 1,
|
only_residenti: 1,
|
||||||
}, (err, arrrec) => {
|
}).lean();
|
||||||
return arrrec
|
|
||||||
}).lean();
|
return result;
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.log('findInternalPages', err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const MyPage = mongoose.model('MyPage', MyPageSchema);
|
const MyPage = mongoose.model('MyPage', MyPageSchema);
|
||||||
|
|
||||||
MyPage.createIndexes((err) => {
|
MyPage.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyPage };
|
module.exports = { MyPage };
|
||||||
|
|||||||
@@ -158,8 +158,9 @@ MySchedaSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const MyScheda = mongoose.model('MyScheda', MySchedaSchema);
|
const MyScheda = mongoose.model('MyScheda', MySchedaSchema);
|
||||||
|
|
||||||
MyScheda.createIndexes((err) => {
|
MyScheda.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa, IImg };
|
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa, IImg };
|
||||||
|
|||||||
@@ -373,8 +373,4 @@ MySkillSchema.statics.getCompleteRecord = function (idapp, id) {
|
|||||||
|
|
||||||
const MySkill = mongoose.model('MySkill', MySkillSchema);
|
const MySkill = mongoose.model('MySkill', MySkillSchema);
|
||||||
|
|
||||||
MySkill.createIndexes((err) => {
|
|
||||||
if (err) throw err;
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = { MySkill };
|
module.exports = { MySkill };
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ const NewstosentSchema = new Schema({
|
|||||||
|
|
||||||
NewstosentSchema.statics.getFieldsForSearch = function () {
|
NewstosentSchema.statics.getFieldsForSearch = function () {
|
||||||
return [{ field: 'name', type: tools.FieldType.string },
|
return [{ field: 'name', type: tools.FieldType.string },
|
||||||
{ field: 'surname', type: tools.FieldType.string },
|
{ field: 'surname', type: tools.FieldType.string },
|
||||||
{ field: 'email', type: tools.FieldType.string }]
|
{ field: 'email', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
NewstosentSchema.statics.executeQueryTable = function (idapp, params) {
|
NewstosentSchema.statics.executeQueryTable = function (idapp, params) {
|
||||||
@@ -85,11 +85,7 @@ NewstosentSchema.statics.findNewsletter_To_Send = function (idapp) {
|
|||||||
processing_job: false,
|
processing_job: false,
|
||||||
finish_job: false,
|
finish_job: false,
|
||||||
idapp
|
idapp
|
||||||
})
|
}).sort({ datetoSent: 1 }).lean();
|
||||||
.sort({ datetoSent: 1 })
|
|
||||||
.then((rec) => {
|
|
||||||
return (rec) ? rec._doc : null;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NewstosentSchema.statics.endJob = async function (id) {
|
NewstosentSchema.statics.endJob = async function (id) {
|
||||||
@@ -127,10 +123,7 @@ NewstosentSchema.statics.findNewsletterPending_To_Send = function (idapp) {
|
|||||||
processing_job: false,
|
processing_job: false,
|
||||||
lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 15) },
|
lastemailsent_Job: { $gte: tools.IncDateNow(-1000 * 60 * 60 * 15) },
|
||||||
idapp
|
idapp
|
||||||
}).then((rec) => {
|
}).lean();
|
||||||
// console.log('findNewsletterPending_To_Send', rec);
|
|
||||||
return (rec) ? rec._doc : null;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NewstosentSchema.statics.findAllIdApp = async function (idapp) {
|
NewstosentSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
@@ -140,9 +133,8 @@ NewstosentSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
||||||
|
|
||||||
return await Newstosent.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NewstosentSchema.statics.getlast = async function (idapp) {
|
NewstosentSchema.statics.getlast = async function (idapp) {
|
||||||
@@ -170,8 +162,9 @@ NewstosentSchema.statics.isActivated = async function (_id) {
|
|||||||
|
|
||||||
const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
|
const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
|
||||||
|
|
||||||
Newstosent.createIndexes((err) => {
|
Newstosent.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Newstosent };
|
module.exports = { Newstosent };
|
||||||
|
|||||||
@@ -104,22 +104,15 @@ OperatorSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
OperatorSchema.statics.findAllIdApp = function (idapp) {
|
OperatorSchema.statics.findAllIdApp = function (idapp) {
|
||||||
const Operator = this;
|
const query = this.find({ idapp }); // Crea la query
|
||||||
|
return query.exec(); // Esegui la query come promessa
|
||||||
const myfind = { idapp };
|
|
||||||
|
|
||||||
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
|
|
||||||
|
|
||||||
|
|
||||||
return Operator.find(myfind, (err, arrrec) => {
|
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Operator = mongoose.model('Operator', OperatorSchema);
|
const Operator = mongoose.model('Operator', OperatorSchema);
|
||||||
|
|
||||||
Operator.createIndexes((err) => {
|
Operator.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Operator };
|
module.exports = { Operator };
|
||||||
|
|||||||
@@ -35,16 +35,15 @@ OpzEmailSchema.statics.executeQueryTable = function (idapp, params) {
|
|||||||
OpzEmailSchema.statics.findAllIdApp = async function (idapp) {
|
OpzEmailSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
const OpzEmail = this;
|
const OpzEmail = this;
|
||||||
|
|
||||||
return await OpzEmail.find({}, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, {});
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema);
|
const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema);
|
||||||
|
|
||||||
OpzEmail.createIndexes((err) => {
|
OpzEmail.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { OpzEmail };
|
module.exports = { OpzEmail };
|
||||||
|
|||||||
@@ -131,9 +131,10 @@ const orderSchema = new Schema({
|
|||||||
|
|
||||||
var Order = module.exports = mongoose.model('Order', orderSchema);
|
var Order = module.exports = mongoose.model('Order', orderSchema);
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports.getFieldsForSearch = function () {
|
module.exports.getFieldsForSearch = function () {
|
||||||
return []
|
return []
|
||||||
@@ -377,7 +378,7 @@ module.exports.updateTotals = function (order) {
|
|||||||
|
|
||||||
module.exports.getTotalOrderById = async function (id) {
|
module.exports.getTotalOrderById = async function (id) {
|
||||||
const query = [
|
const query = [
|
||||||
{ $match: { _id: ObjectId(id) } },
|
{ $match: { _id: new ObjectId(id) } },
|
||||||
{
|
{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
from: 'products',
|
from: 'products',
|
||||||
@@ -642,7 +643,7 @@ module.exports.RemoveDeletedOrdersInOrderscart = async function () {
|
|||||||
if (!orderCart) {
|
if (!orderCart) {
|
||||||
// NON TROVATO ! Allora lo cancello
|
// NON TROVATO ! Allora lo cancello
|
||||||
|
|
||||||
await Order.findOneAndRemove({ _id: ord._id });
|
await Order.findOneAndDelete({ _id: ord._id });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
@@ -660,7 +661,7 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
|
|||||||
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
|
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
|
||||||
|
|
||||||
const myquery = [
|
const myquery = [
|
||||||
{ $match: { idGasordine: ObjectId(myidGasordine) } },
|
{ $match: { idGasordine: new ObjectId(myidGasordine) } },
|
||||||
{
|
{
|
||||||
$lookup: {
|
$lookup: {
|
||||||
from: 'products',
|
from: 'products',
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ module.exports.getRecCartByUserId = async function (uid, idapp, numorder) {
|
|||||||
|
|
||||||
module.exports.getOrdersCartById = async function (id) {
|
module.exports.getOrdersCartById = async function (id) {
|
||||||
|
|
||||||
let query = { _id: ObjectId(id) };
|
let query = { _id: new ObjectId(id) };
|
||||||
|
|
||||||
const arrris = await OrdersCart.getOrdersCartByQuery(query);
|
const arrris = await OrdersCart.getOrdersCartByQuery(query);
|
||||||
let myrec = arrris && arrris.length > 0 ? arrris[0] : null;
|
let myrec = arrris && arrris.length > 0 ? arrris[0] : null;
|
||||||
@@ -543,41 +543,44 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp, numorder, fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports.updateOrdersCartById = function (id, newOrdersCart, callback) {
|
module.exports.updateOrdersCartById = async function(id, newOrdersCart, callback) {
|
||||||
let query = {
|
let query = {
|
||||||
id,
|
id,
|
||||||
deleted: false,
|
deleted: false,
|
||||||
}
|
}
|
||||||
OrdersCart.find(query, function (err, c) {
|
try {
|
||||||
if (err) throw err
|
const c = await OrdersCart.find(query);
|
||||||
|
} catch (err) {
|
||||||
|
console.log('ERR: updateOrdersCartById', err);
|
||||||
|
if (err) throw err;
|
||||||
|
}
|
||||||
|
|
||||||
//exist cart in databse
|
//exist cart in databse
|
||||||
if (c.length > 0) {
|
if (c.length > 0) {
|
||||||
return OrdersCart.findOneAndUpdate(
|
return OrdersCart.findOneAndUpdate(
|
||||||
{ _id: id },
|
{ _id: id },
|
||||||
{
|
{
|
||||||
$set: {
|
$set: {
|
||||||
items: newOrdersCart.items,
|
items: newOrdersCart.items,
|
||||||
totalQty: newOrdersCart.totalQty,
|
totalQty: newOrdersCart.totalQty,
|
||||||
totalQtyPreordered: newOrdersCart.totalQtyPreordered,
|
totalQtyPreordered: newOrdersCart.totalQtyPreordered,
|
||||||
totalPrice: newOrdersCart.totalPrice,
|
totalPrice: newOrdersCart.totalPrice,
|
||||||
totalPriceCalc: newOrdersCart.totalPriceCalc ? newOrdersCart.totalPriceCalc : newOrdersCart.totalPrice,
|
totalPriceCalc: newOrdersCart.totalPriceCalc ? newOrdersCart.totalPriceCalc : newOrdersCart.totalPrice,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
status: newOrdersCart.status,
|
status: newOrdersCart.status,
|
||||||
numorder: newOrdersCart.numorder,
|
numorder: newOrdersCart.numorder,
|
||||||
numord_pers: newOrdersCart.numord_pers,
|
numord_pers: newOrdersCart.numord_pers,
|
||||||
note: newOrdersCart.note,
|
note: newOrdersCart.note,
|
||||||
modify_at: new Date(),
|
modify_at: new Date(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ new: true },
|
{ new: true },
|
||||||
callback
|
callback
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
//no cart in database
|
//no cart in database
|
||||||
return newOrdersCart.save(callback)
|
return newOrdersCart.save(callback)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.setFieldInOrdersById = async function (objtoset, myOrderCart) {
|
module.exports.setFieldInOrdersById = async function (objtoset, myOrderCart) {
|
||||||
@@ -616,10 +619,10 @@ module.exports.deleteRecsInOrdersById = async function (myOrderCart) {
|
|||||||
let ris2 = null;
|
let ris2 = null;
|
||||||
// Imposta su tutti i singoli prodotti ordinati (Order)
|
// Imposta su tutti i singoli prodotti ordinati (Order)
|
||||||
for (const recitem of myOrderCart.items) {
|
for (const recitem of myOrderCart.items) {
|
||||||
ris2 = await Order.findOneAndRemove({ _id: recitem.order._id })
|
ris2 = await Order.findOneAndDelete({ _id: recitem.order._id })
|
||||||
}
|
}
|
||||||
|
|
||||||
const ris = await OrdersCart.findOneAndRemove({ _id: myOrderCart._id })
|
const ris = await OrdersCart.findOneAndDelete({ _id: myOrderCart._id })
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Err', e);
|
console.log('Err', e);
|
||||||
@@ -1045,19 +1048,6 @@ OrdersCartSchema.pre('save', async function (next) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (user.isModified('password')) {
|
|
||||||
bcrypt.genSalt(10, (err, salt) => {
|
|
||||||
bcrypt.hash(user.password, salt, (err, hash) => {
|
|
||||||
user.password = hash;
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.message);
|
console.error(e.message);
|
||||||
@@ -1171,6 +1161,7 @@ module.exports.getmsgorderTelegram = async function (ordersCart) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -38,15 +38,15 @@ PaymentTypeSchema.statics.findAllIdApp = async function (idapp) {
|
|||||||
|
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await PaymentType.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, myfind);
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const PaymentType = mongoose.model('Paymenttype', PaymentTypeSchema);
|
const PaymentType = mongoose.model('Paymenttype', PaymentTypeSchema);
|
||||||
|
|
||||||
PaymentType.createIndexes((err) => {
|
PaymentType.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { PaymentType };
|
module.exports = { PaymentType };
|
||||||
|
|||||||
@@ -50,15 +50,14 @@ PermissionSchema.statics.findAllIdApp = async function () {
|
|||||||
|
|
||||||
const myfind = {};
|
const myfind = {};
|
||||||
|
|
||||||
return await Permission.find(myfind, (err, arrrec) => {
|
return await tools.findAllQueryIdApp(this, {});
|
||||||
return arrrec
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const Permission = mongoose.model('Permission', PermissionSchema);
|
const Permission = mongoose.model('Permission', PermissionSchema);
|
||||||
|
|
||||||
Permission.createIndexes((err) => {
|
Permission.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Permission };
|
module.exports = { Permission };
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
|||||||
module.exports.findAllIdApp = async function (idapp) {
|
module.exports.findAllIdApp = async function (idapp) {
|
||||||
const myfind = { idapp };
|
const myfind = { idapp };
|
||||||
|
|
||||||
return await Producer.find(myfind);
|
return await Producer.find(myfind).lean();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getAllProducers = function (query, sort, callback) {
|
module.exports.getAllProducers = function (query, sort, callback) {
|
||||||
@@ -101,6 +101,7 @@ module.exports.getProducerByID = function (id, callback) {
|
|||||||
|
|
||||||
// module.exports = { Producer };
|
// module.exports = { Producer };
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -764,9 +764,10 @@ module.exports.updateProductInOrder = async function (order) {
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports.convertAfterImportALLPROD = async function (idapp, dataObjects) {
|
module.exports.convertAfterImportALLPROD = async function (idapp, dataObjects) {
|
||||||
|
|
||||||
@@ -841,18 +842,16 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
|
|||||||
{ $sort: { name: 1 } }
|
{ $sort: { name: 1 } }
|
||||||
];
|
];
|
||||||
|
|
||||||
arr = await Product.aggregate(myquery, (err, result) => {
|
try {
|
||||||
if (err) {
|
let arr = [];
|
||||||
console.error(err);
|
arr = await Product.aggregate(myquery);
|
||||||
// Gestisci l'errore come desideri
|
|
||||||
return [];
|
// arr = result.map(category => category.name);
|
||||||
} else {
|
return arr;
|
||||||
const uniqueCategories = result.map(category => category.name);
|
} catch (e) {
|
||||||
// console.log(uniqueCategories);
|
console.error('err', e);
|
||||||
return uniqueCategories;
|
}
|
||||||
// Ora uniqueCategories contiene l'array delle categorie univoche utilizzate in tutti i prodotti con active = true
|
// Ora uniqueCategories contiene l'array delle categorie univoche utilizzate in tutti i prodotti con active = true
|
||||||
}
|
|
||||||
});
|
|
||||||
return arr;
|
return arr;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('err', e);
|
console.error('err', e);
|
||||||
@@ -1015,7 +1014,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!tools.isObjectEmpty(objtoset)) {
|
if (!tools.isObjectEmpty(objtoset)) {
|
||||||
ris = await Product.findOneAndUpdate({ _id: ObjectId(prod._id) }, { $set: objtoset })
|
ris = await Product.findOneAndUpdate({ _id: new ObjectId(prod._id) }, { $set: objtoset })
|
||||||
|
|
||||||
const objDelete = {
|
const objDelete = {
|
||||||
cat_name: 1,
|
cat_name: 1,
|
||||||
@@ -1028,7 +1027,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
|
|||||||
gas_name: 1,
|
gas_name: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
ris = await Product.updateOne({ _id: ObjectId(prod._id) }, { $unset: objDelete })
|
ris = await Product.updateOne({ _id: new ObjectId(prod._id) }, { $unset: objDelete })
|
||||||
|
|
||||||
if (ris && ris.nModified > 0) {
|
if (ris && ris.nModified > 0) {
|
||||||
console.log('Modificato: ', objtoset.name);
|
console.log('Modificato: ', objtoset.name);
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ module.exports.correggiProductTypes = async function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.createIndexes((err) => {
|
module.exports.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
|
|||||||
|
|
||||||
console.log('INIT getIdParentByIdProj', idProj);
|
console.log('INIT getIdParentByIdProj', idProj);
|
||||||
|
|
||||||
return Project.findOne({ '_id': ObjectId(idProj) }).then(rec => {
|
return Project.findOne({ '_id': new ObjectId(idProj) }).then(rec => {
|
||||||
if (!!rec) {
|
if (!!rec) {
|
||||||
console.log('getIdParentByIdProj', rec.id_parent);
|
console.log('getIdParentByIdProj', rec.id_parent);
|
||||||
return rec.id_parent;
|
return rec.id_parent;
|
||||||
@@ -428,9 +428,10 @@ ProjectSchema.pre('save', function (next) {
|
|||||||
|
|
||||||
var Project = mongoose.model('Projects', ProjectSchema);
|
var Project = mongoose.model('Projects', ProjectSchema);
|
||||||
|
|
||||||
Project.createIndexes((err) => {
|
Project.createIndexes()
|
||||||
if (err) throw err;
|
.then(() => { })
|
||||||
});
|
.catch((err) => { throw err; });
|
||||||
|
|
||||||
|
|
||||||
module.exports = { Project };
|
module.exports = { Project };
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user