Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39784aeb0e | ||
|
|
45be5038b9 | ||
|
|
c631ca9d6a | ||
|
|
fa075683ae | ||
|
|
836f7f572b | ||
|
|
9fb7df56e6 | ||
|
|
7f6ed73763 | ||
|
|
300bab2125 | ||
|
|
14b3e18986 | ||
|
|
14bca3e282 | ||
|
|
8803190313 | ||
|
|
c914555a5f | ||
|
|
351b81308a | ||
|
|
a42c365052 | ||
|
|
479934a8fb | ||
|
|
b1b952d120 | ||
|
|
73cf977754 | ||
|
|
f89281e316 | ||
|
|
b7ffd751dc | ||
|
|
3bdab927b6 | ||
|
|
fa1a2a7cdb | ||
|
|
5dac17d1d1 | ||
|
|
2ac1bc4b7d | ||
|
|
27aa42507a | ||
|
|
0d466f01b6 | ||
|
|
c82bc117cc | ||
|
|
491c9bc220 | ||
|
|
d438867e3a | ||
|
|
f9e0175f9b | ||
|
|
03e5d2ed81 | ||
|
|
ff1344c06f | ||
|
|
492f599cd9 |
@@ -4,8 +4,9 @@ PDB=mypassword@1A
|
||||
SEND_EMAIL=0
|
||||
SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","17","18"]
|
||||
appTelegram=["1","17","18"]
|
||||
appTelegram_TEST=["1","17"]
|
||||
appTelegram=["1","17"]
|
||||
appTelegram_DEVELOP=["17"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
@@ -31,7 +32,6 @@ GCM_API_KEY=""
|
||||
PROD=0
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
||||
SECRTK=prova123prova567ASDADASDAS
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
FTPSERVER_HOST=139.162.166.31
|
||||
|
||||
@@ -6,6 +6,7 @@ SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
appTelegram_DEVELOP=["13"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
@@ -31,7 +32,6 @@ GCM_API_KEY=""
|
||||
PROD=0
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
||||
SECRTK=prova123prova567ASDADASDAS
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
FTPSERVER_HOST=139.162.166.31
|
||||
|
||||
@@ -6,6 +6,7 @@ SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
appTelegram_DEVELOP=["13"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
@@ -31,7 +32,6 @@ GCM_API_KEY=""
|
||||
PROD=0
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
|
||||
SECRTK=prova123prova567ASDADASDAS
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
FTPSERVER_HOST=139.162.166.31
|
||||
|
||||
38
.env.prod.freeplanet.app
Normal file
@@ -0,0 +1,38 @@
|
||||
DATABASE=FreePlanet
|
||||
UDB=paofreeplanet
|
||||
PDB=suerteFreePlanet@1A
|
||||
SEND_EMAIL=1
|
||||
PORT=3000
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
||||
SERVERDIR_WEBSITE=/var/www/www.freeplanet_server
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadminREAL@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
LOCALE=0
|
||||
DELAY_SENDEMAIL=1000
|
||||
VAPI_KEY_SUBJECT="mailto:paolo@freeplanet.app"
|
||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||
PATH_CERT_KEY=key.pem
|
||||
PATH_SERVER_CRT=cert.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"freeplanet.app","port":"3000"}]
|
||||
#DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
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
|
||||
@@ -7,8 +7,8 @@ PORT=3000
|
||||
appTelegram_TEST=["17","18"]
|
||||
appTelegram=["17","18"]
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
||||
SERVERDIR_WEBSITE=
|
||||
DIRECTORY_SERVER=/var/www/nodejs_piuchebuono_server
|
||||
SERVERDIR_WEBSITE=/var/www/piuchebuono.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32001/
|
||||
AUTH_MONGODB=1
|
||||
@@ -29,11 +29,10 @@ PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
SECRTK=jAxKm02emx5SeJvz2IGmtRf6YqCgope
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNVZZ
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3000"},{"hostname":"gruppomacro.app","port":"3010"}]
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3030"},{"hostname":"gruppomacro.app","port":"3010"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
|
||||
38
.env.prod.riso
Normal file
@@ -0,0 +1,38 @@
|
||||
DATABASE=FreePlanet
|
||||
UDB=paofreeplanet
|
||||
PDB=suerteFreePlanet@1A
|
||||
SEND_EMAIL=1
|
||||
PORT=0
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_riso_server
|
||||
SERVERDIR_WEBSITE=/var/www/riso.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32015/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadminREAL@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
LOCALE=0
|
||||
DELAY_SENDEMAIL=1000
|
||||
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||
PATH_CERT_KEY=key.pem
|
||||
PATH_SERVER_CRT=cert.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"riso.app","port":"3006"},{"hostname":"freeplanet.app","port":"3000"}]
|
||||
#DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
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
|
||||
@@ -8,7 +8,7 @@ appTelegram_TEST=["17","18"]
|
||||
appTelegram=["17","18"]
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_test.piuchebuono_server
|
||||
SERVERDIR_WEBSITE=test.piuchebuono.app
|
||||
SERVERDIR_WEBSITE=var/www/test.piuchebuono.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32002/
|
||||
AUTH_MONGODB=1
|
||||
@@ -32,7 +32,7 @@ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3001"},{"hostname":"gruppomacro.app","port":"3011"}]
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3031"},{"hostname":"gruppomacro.app","port":"3011"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
|
||||
@@ -5,7 +5,7 @@ SEND_EMAIL=1
|
||||
PORT=3001
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_test.riso_server
|
||||
SERVERDIR_WEBSITE=test.riso.app
|
||||
SERVERDIR_WEBSITE=/var/www/test.riso.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32012/
|
||||
AUTH_MONGODB=1
|
||||
@@ -26,10 +26,10 @@ PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=0
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
TOKEN_LIFE=1m
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
DOMAINS=[{"hostname":"riso.app","port":"3005"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
|
||||
1
.gitignore
vendored
@@ -3,6 +3,7 @@ node_modules/
|
||||
.env.production
|
||||
.env.production.bak
|
||||
ESEMPI/
|
||||
OFF/
|
||||
.idea
|
||||
package-lock.json
|
||||
deploynodejs_on_production.sh
|
||||
|
||||
5
.vscode/launch.json
vendored
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch via Nodemon",
|
||||
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
|
||||
"restart": true,
|
||||
"runtimeExecutable": "node",
|
||||
"runtimeExecutable": "/usr/local/bin/node",
|
||||
"runtimeArgs": [
|
||||
"--inspect=9229" // Use "--inspect=0.0.0.0:9229" for remote debugging
|
||||
],
|
||||
@@ -30,7 +31,7 @@
|
||||
"name": "Launch Trace Warning",
|
||||
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
|
||||
"restart": true,
|
||||
"runtimeExecutable": "node",
|
||||
"runtimeExecutable": "/usr/local/bin/node",
|
||||
"runtimeArgs": [
|
||||
"--trace-warnings" // Use "--inspect=0.0.0.0:9229" for remote debugging
|
||||
],
|
||||
|
||||
148049
.yarn/releases/yarn-1.22.22.cjs
vendored
Executable file
5
.yarnrc
Normal file
@@ -0,0 +1,5 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
yarn-path ".yarn/releases/yarn-1.22.22.cjs"
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
echo "Sincronizzazione di 1 FILE in corso..."
|
||||
rsync -avz -e 'ssh -p 8855' src/server/tools/general.js suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/src/server/tools/general.js
|
||||
rsync -avz -e 'ssh -p 8855' src/server/tools/general.js suryapaolo@servereng:$SERVERDIR_WEBSITE/src/server/tools/general.js
|
||||
echo "Sincronizzazione TERMINATA - SERVER PRODUZIONE!"
|
||||
fi
|
||||
|
||||
67
deploynodejs_on_prod_freeplanet.app.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.prod.freeplanet.app
|
||||
|
||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="suryapaolo"
|
||||
REMOTE_HOST="servereng"
|
||||
REMOTE_PORT="8855"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
CONFIG_JS="ecosystem.config.prod_freeplanet.app.js"
|
||||
ENV_FILE=".env.prod.freeplanet.app"
|
||||
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
|
||||
|
||||
70
deploynodejs_on_prod_riso.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/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
|
||||
|
||||
@@ -19,16 +19,16 @@ 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:/var/www/$SERVERDIR_WEBSITE/.env.test
|
||||
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:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' package.json suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/package.json
|
||||
rsync -avz -e 'ssh -p 8855' css suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' docs suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' emails suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' images suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' plugins suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8855' sass suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/
|
||||
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
|
||||
0
docs/aaa.js
Normal file
36
docs/apache2/contatti.htm
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- wp:themify-builder/canvas /-->
|
||||
|
||||
<!--themify_builder_static-->
|
||||
<h3>Contattaci</h3>
|
||||
<p><strong>Hai domande, consigli o suggerimenti da proporci?</strong><br />Inviaci un messaggio attraverso il form qui
|
||||
sotto!</p>
|
||||
<form action="https://www.fioredellavita.it/wp-admin/admin-ajax.php" class="builder-contact" id="tb_th9k520-form"
|
||||
method="post" data-post-id="0" data-element-id="th9k520" data-orig-id=""> <label for="field_extra_tb_th9k520_0">
|
||||
Invia a: <input type="hidden" name="field_extra_name_0" value="Invia a:"> * </label> <select
|
||||
id="field_extra_tb_th9k520_0" name="field_extra_0" required>
|
||||
<option value="Seleziona destinatario"> Seleziona destinatario </option>
|
||||
<option value="ordiniweb@gruppomacro.com"> ordiniweb@gruppomacro.com </option>
|
||||
</select> <label for="tb_th9k520-contact-subject">Oggetto richiesta: *</label> <input type="text"
|
||||
name="contact-subject" placeholder="" id="tb_th9k520-contact-subject" value="" required> <label
|
||||
for="tb_th9k520-contact-name">Nome *</label> <input type="text" name="contact-name" placeholder=""
|
||||
id="tb_th9k520-contact-name" value="" required> <label for="field_extra_tb_th9k520_1"> Cognome <input
|
||||
type="hidden" name="field_extra_name_1" value="Cognome"> * </label> <input type="text" name="field_extra_1"
|
||||
id="field_extra_tb_th9k520_1" placeholder="" required> <label for="tb_th9k520-contact-email">E-mail *</label>
|
||||
<input type="text" name="contact-email" placeholder="" id="tb_th9k520-contact-email" value="" required> <label
|
||||
for="field_extra_tb_th9k520_2"> Telefono <input type="hidden" name="field_extra_name_2" value="Telefono">
|
||||
</label> <input type="tel" name="field_extra_2" id="field_extra_tb_th9k520_2" placeholder=""> <label
|
||||
for="tb_th9k520-contact-message">Descrivi la tua richiesta: </label> <textarea name="contact-message"
|
||||
placeholder="" id="tb_th9k520-contact-message"></textarea> <label> <input type="checkbox" name="gdpr" value="1"
|
||||
required> Ho letto l'Informativa sulla privacy nella pagina <a href="/contatti"> Privacy Policy</a> del Sito
|
||||
e acconsento al trattamento dei dati inseriti. * </label> <label> Verifica antispam * </label> <button
|
||||
type="submit">Invia</button> </form>
|
||||
<h3>Dove siamo</h3>
|
||||
<p><strong>Macro Società Cooperativa srl</strong><br />Via Giardino, 30 – 47522 – Cesena (FC)</p>
|
||||
<p>Fai click sulla mappa (OpenStreetMap) per trovare il percorso dal tuo indirizzo.</p>
|
||||
<a
|
||||
href="https://www.openstreetmap.org/search?query=Via%20Giardino%2C%2030%20%E2%80%93%2047522%20%E2%80%93%20Cesena%20(FC)#map=16/44.1525/12.2062">
|
||||
<img decoding="async" loading="lazy" width="500" height="499"
|
||||
src="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg" title="mappa-macro"
|
||||
alt="mappa-macro"
|
||||
srcset="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg 500w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-300x300.jpg 300w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-150x150.jpg 150w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-320x319.jpg 320w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-100x100.jpg 100w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-50x50.jpg 50w"
|
||||
sizes="(max-width: 500px) 100vw, 500px" /> </a><!--/themify_builder_static-->
|
||||
429
docs/libro1.htm
Normal file
@@ -0,0 +1,429 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22467 -->
|
||||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Link Page</title>
|
||||
<style>
|
||||
#loading {
|
||||
display: none;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid #f3f3f3;
|
||||
border-top: 5px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Links</h1>
|
||||
<form id="articleForm">
|
||||
<pre> Per vedere la lista -> "LIBRI IN PREVENDITA"
|
||||
in <span style="color: green;">VERDE</span> quelli in PreOrdine
|
||||
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
|
||||
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
|
||||
</pre>
|
||||
<label for="article_id">ID Articolo or Ordine:</label>
|
||||
<input type="text" id="article_id" name="id" value="22467">
|
||||
<input type="text" id="action" name="action" value="" hidden="">
|
||||
<br>
|
||||
<button type="button" data-action="search">Cerca Articolo</button>
|
||||
<button type="button" data-action="search_isbn">Cerca ISBN</button>
|
||||
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
|
||||
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
|
||||
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
|
||||
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
|
||||
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
|
||||
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
|
||||
<br><br>
|
||||
|
||||
<button type="button" data-action="showTest">Test</button>
|
||||
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
|
||||
<button type="button" data-action="cartolibri">Cartolibri</button>
|
||||
<button type="button" data-action="riviste">Riviste</button>
|
||||
<button type="button" data-action="showOrdini">Mostra Ordini</button>
|
||||
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
|
||||
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
|
||||
<button type="button" data-action="Vendite">Vendite</button>
|
||||
|
||||
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
|
||||
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
|
||||
</form>
|
||||
<div>
|
||||
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
|
||||
|
||||
</div>
|
||||
<div id="result">Articles di 22467 :
|
||||
<pre>[
|
||||
{
|
||||
"Id": "258787",
|
||||
"IdArticolo": "22467",
|
||||
"Ean13": "9788828510147",
|
||||
"Titolo": "Le Stelle Cadranno dal Cielo?",
|
||||
"ListaAutori": "17",
|
||||
"ListaArgomenti": "9",
|
||||
"IdStatoProdotto": "34",
|
||||
"PrezzoIvato": "24.9000",
|
||||
"IdMarchioEditoriale": "1",
|
||||
"IdCollana": "73",
|
||||
"DataPubblicazione": "2025-01-14 00:00:00.000",
|
||||
"IdTipologia": "1",
|
||||
"IdTipoFormato": "1",
|
||||
"Misure": "cm 13,5x20,5",
|
||||
"Pagine": "192",
|
||||
"Sottotitolo": "Non \u00e8 una catastrofe ma la Rivelazione dell'Universo reale",
|
||||
"Durata": "",
|
||||
"Numero": "",
|
||||
"Edizione": "Dicembre 2024",
|
||||
"Ristampa": "",
|
||||
"DataInizioCampagna": "2024-11-07 00:00:00.000",
|
||||
"DataFineCampagna": "2099-12-31 00:00:00.000",
|
||||
"ScontoCampagna": "5.00",
|
||||
"PrezzoIvatoScontatoCampagna": "23.6550",
|
||||
"DataOra": "2024-12-19 09:24:01.593",
|
||||
"Enabled": "0",
|
||||
"IDTagGruppo": "0",
|
||||
"Utente": "FLANZA-NOTE",
|
||||
"PercIva": ".00",
|
||||
"IdTitoloOriginale": "13415",
|
||||
"EnabledAlFresco": "1",
|
||||
"CodEdizione": "16",
|
||||
"FasciaEta": null,
|
||||
"FasciaEta2": null,
|
||||
"data": "2024-12-19 09:24:01.593",
|
||||
"DescrizioneStatoProdotto": "In prevendita",
|
||||
"Codice": "22467",
|
||||
"QtaDisponibile": "-6"
|
||||
}
|
||||
]</pre>Product:
|
||||
<pre>{
|
||||
"id": 74617,
|
||||
"name": "Le stelle cadranno dal cielo? - Nuovo",
|
||||
"slug": "le-stelle-cadranno-dal-cielo-nuovo",
|
||||
"permalink": "https:\/\/www.fioredellavita.it\/le-stelle-cadranno-dal-cielo\/?attribute_pa_versione=nuovo",
|
||||
"date_created": "2024-12-19T15:26:11",
|
||||
"date_created_gmt": "2024-12-19T14:26:11",
|
||||
"date_modified": "2024-12-20T13:02:31",
|
||||
"date_modified_gmt": "2024-12-20T12:02:31",
|
||||
"type": "variation",
|
||||
"status": "publish",
|
||||
"featured": false,
|
||||
"catalog_visibility": "visible",
|
||||
"description": "",
|
||||
"short_description": "",
|
||||
"sku": "22467",
|
||||
"price": "23.6550",
|
||||
"regular_price": "24.9000",
|
||||
"sale_price": "23.6550",
|
||||
"date_on_sale_from": "2024-11-07T00:00:00",
|
||||
"date_on_sale_from_gmt": "2024-11-06T23:00:00",
|
||||
"date_on_sale_to": "2099-12-31T23:59:59",
|
||||
"date_on_sale_to_gmt": "2099-12-31T22:59:59",
|
||||
"on_sale": true,
|
||||
"purchasable": true,
|
||||
"total_sales": "0",
|
||||
"virtual": false,
|
||||
"downloadable": false,
|
||||
"downloads": [],
|
||||
"download_limit": -1,
|
||||
"download_expiry": -1,
|
||||
"external_url": "",
|
||||
"button_text": "",
|
||||
"tax_status": "taxable",
|
||||
"tax_class": "",
|
||||
"manage_stock": true,
|
||||
"stock_quantity": 10000,
|
||||
"backorders": "no",
|
||||
"backorders_allowed": false,
|
||||
"backordered": false,
|
||||
"low_stock_amount": null,
|
||||
"sold_individually": false,
|
||||
"weight": "",
|
||||
"dimensions": {
|
||||
"length": "",
|
||||
"width": "",
|
||||
"height": ""
|
||||
},
|
||||
"shipping_required": true,
|
||||
"shipping_taxable": true,
|
||||
"shipping_class": "",
|
||||
"shipping_class_id": 0,
|
||||
"reviews_allowed": false,
|
||||
"average_rating": "0.00",
|
||||
"rating_count": 0,
|
||||
"upsell_ids": [],
|
||||
"cross_sell_ids": [],
|
||||
"parent_id": 70642,
|
||||
"purchase_note": "",
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"images": [
|
||||
{
|
||||
"id": 73623,
|
||||
"date_created": "2024-11-20T11:12:29",
|
||||
"date_created_gmt": "2024-11-20T09:12:29",
|
||||
"date_modified": "2024-12-20T14:02:31",
|
||||
"date_modified_gmt": "2024-12-20T12:02:31",
|
||||
"src": "https:\/\/i0.wp.com\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/le-stella-cadranno-dal-cielo-copertina-web.jpg?fit=450%2C624&ssl=1",
|
||||
"name": "le-stella-cadranno-dal-cielo-copertina-web",
|
||||
"alt": "\"Le stelle cadranno dal cielo?\""
|
||||
}
|
||||
],
|
||||
"attributes": [
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Versione",
|
||||
"slug": "pa_versione",
|
||||
"option": "Nuovo"
|
||||
}
|
||||
],
|
||||
"default_attributes": [],
|
||||
"variations": [],
|
||||
"grouped_products": [],
|
||||
"menu_order": 0,
|
||||
"price_html": "<del aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>24,90<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/del> <span class="\"screen-reader-text\"">Il prezzo originale era: 24,90€.<\/span><ins aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>23,66<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/ins><span class="\"screen-reader-text\"">Il prezzo attuale \u00e8: 23,66€.<\/span>",
|
||||
"related_ids": [],
|
||||
"meta_data": [
|
||||
{
|
||||
"id": 1521527,
|
||||
"key": "ISBN",
|
||||
"value": "9788828510147"
|
||||
},
|
||||
{
|
||||
"id": 1521528,
|
||||
"key": "misure",
|
||||
"value": "cm 13,5x20,5"
|
||||
},
|
||||
{
|
||||
"id": 1521529,
|
||||
"key": "formato",
|
||||
"value": "Brossura"
|
||||
},
|
||||
{
|
||||
"id": 1521530,
|
||||
"key": "pagine",
|
||||
"value": "192"
|
||||
},
|
||||
{
|
||||
"id": 1521531,
|
||||
"key": "edizione",
|
||||
"value": "Dicembre 2024"
|
||||
},
|
||||
{
|
||||
"id": 1521532,
|
||||
"key": "DataPubblicazione",
|
||||
"value": "1736809200"
|
||||
},
|
||||
{
|
||||
"id": 1521533,
|
||||
"key": "DataPubbStr",
|
||||
"value": "14\/01\/2025"
|
||||
},
|
||||
{
|
||||
"id": 1521535,
|
||||
"key": "_wpro_variable_is_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521536,
|
||||
"key": "_is_pre_order",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521537,
|
||||
"key": "_pre_order_date",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521538,
|
||||
"key": "_wpro_date_label_variable",
|
||||
"value": "Prenotalo per riceverlo entro il 14 gennaio 2025"
|
||||
},
|
||||
{
|
||||
"id": 1521539,
|
||||
"key": "_wpro_no_date_label_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521540,
|
||||
"key": "_wpro_manage_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521541,
|
||||
"key": "_wpro_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521542,
|
||||
"key": "_wpro_label_variable",
|
||||
"value": "Pre Ordinalo!"
|
||||
},
|
||||
{
|
||||
"id": 1521543,
|
||||
"key": "_wpro_price_type_variable",
|
||||
"value": "manual"
|
||||
},
|
||||
{
|
||||
"id": 1521544,
|
||||
"key": "_wpro_amount_price_variable",
|
||||
"value": "fixed"
|
||||
},
|
||||
{
|
||||
"id": 1521545,
|
||||
"key": "_wpro_date_variable",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521546,
|
||||
"key": "_wpro_time_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521547,
|
||||
"key": "_rank_math_gtin_code",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521680,
|
||||
"key": "_ywpo_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521681,
|
||||
"key": "_ywpo_availability_date_mode",
|
||||
"value": "date"
|
||||
},
|
||||
{
|
||||
"id": 1521682,
|
||||
"key": "_ywpo_for_sale_date",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521683,
|
||||
"key": "_ywpo_price_mode",
|
||||
"value": "default"
|
||||
},
|
||||
{
|
||||
"id": 1521684,
|
||||
"key": "_ywpo_preorder_price",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"id": 1521685,
|
||||
"key": "_ywpo_preorder_discount_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521686,
|
||||
"key": "_ywpo_preorder_discount_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521687,
|
||||
"key": "_ywpo_preorder_increase_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521688,
|
||||
"key": "_ywpo_preorder_increase_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521711,
|
||||
"key": "woo_feed_availability_date_var",
|
||||
"value": "2025-01-14"
|
||||
}
|
||||
],
|
||||
"stock_status": "instock",
|
||||
"has_options": false,
|
||||
"post_password": "",
|
||||
"global_unique_id": "",
|
||||
"jetpack_sharing_enabled": true,
|
||||
"jetpack-related-posts": [],
|
||||
"builder_content": "",
|
||||
"_links": {
|
||||
"self": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/74617",
|
||||
"targetHints": {
|
||||
"allow": [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"collection": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
|
||||
}
|
||||
],
|
||||
"up": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/70642"
|
||||
}
|
||||
]
|
||||
}
|
||||
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
|
||||
<div id="loading" style="display: none;"></div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('articleForm');
|
||||
const result = document.getElementById('result');
|
||||
const loading = document.getElementById('loading');
|
||||
|
||||
const buttons = form.querySelectorAll('button');
|
||||
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
|
||||
|
||||
function handleButtonClick(event) {
|
||||
let action = event.target.dataset.action;
|
||||
let id = '0';
|
||||
try {
|
||||
id = form.querySelector('input[name="id"]').value;
|
||||
if (!action) {
|
||||
action = form.querySelector('input[name="action"]').value;
|
||||
}
|
||||
} catch (e) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
loading.style.display = 'block'; // Mostra la clessidra
|
||||
|
||||
let baseUrl = window.location.href;
|
||||
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
|
||||
|
||||
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
result.innerHTML = data;
|
||||
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>
|
||||
403
docs/libro2.htm
Normal file
@@ -0,0 +1,403 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22753 -->
|
||||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Link Page</title>
|
||||
<style>
|
||||
#loading {
|
||||
display: none;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid #f3f3f3;
|
||||
border-top: 5px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Links</h1>
|
||||
<form id="articleForm">
|
||||
<pre> Per vedere la lista -> "LIBRI IN PREVENDITA"
|
||||
in <span style="color: green;">VERDE</span> quelli in PreOrdine
|
||||
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
|
||||
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
|
||||
</pre>
|
||||
<label for="article_id">ID Articolo or Ordine:</label>
|
||||
<input type="text" id="article_id" name="id" value="22753">
|
||||
<input type="text" id="action" name="action" value="" hidden="">
|
||||
<br>
|
||||
<button type="button" data-action="search">Cerca Articolo</button>
|
||||
<button type="button" data-action="search_isbn">Cerca ISBN</button>
|
||||
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
|
||||
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
|
||||
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
|
||||
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
|
||||
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
|
||||
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
|
||||
<br><br>
|
||||
|
||||
<button type="button" data-action="showTest">Test</button>
|
||||
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
|
||||
<button type="button" data-action="cartolibri">Cartolibri</button>
|
||||
<button type="button" data-action="riviste">Riviste</button>
|
||||
<button type="button" data-action="showOrdini">Mostra Ordini</button>
|
||||
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
|
||||
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
|
||||
<button type="button" data-action="Vendite">Vendite</button>
|
||||
|
||||
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
|
||||
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
|
||||
</form>
|
||||
<div>
|
||||
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
|
||||
|
||||
</div>
|
||||
<div id="result">Articles di 22753 :
|
||||
<pre>[
|
||||
{
|
||||
"Id": "258799",
|
||||
"IdArticolo": "22753",
|
||||
"Ean13": "9788865934883",
|
||||
"Titolo": "La Storia di Flumeide e la Bambina",
|
||||
"ListaAutori": "4184",
|
||||
"ListaArgomenti": "6",
|
||||
"IdStatoProdotto": "34",
|
||||
"PrezzoIvato": "13.0000",
|
||||
"IdMarchioEditoriale": "34",
|
||||
"IdCollana": "1033",
|
||||
"DataPubblicazione": "2025-01-21 00:00:00.000",
|
||||
"IdTipologia": "1",
|
||||
"IdTipoFormato": "1",
|
||||
"Misure": "cm 28x19",
|
||||
"Pagine": "32",
|
||||
"Sottotitolo": "Una fiaba per grandi",
|
||||
"Durata": "",
|
||||
"Numero": "",
|
||||
"Edizione": "Gennaio 2025",
|
||||
"Ristampa": "",
|
||||
"DataInizioCampagna": "2024-11-15 00:00:00.000",
|
||||
"DataFineCampagna": "2099-11-15 00:00:00.000",
|
||||
"ScontoCampagna": "5.00",
|
||||
"PrezzoIvatoScontatoCampagna": "12.3500",
|
||||
"DataOra": "2024-12-19 11:16:13.993",
|
||||
"Enabled": "0",
|
||||
"IDTagGruppo": "0",
|
||||
"Utente": "AZANGHERI-NOTE",
|
||||
"PercIva": ".00",
|
||||
"IdTitoloOriginale": "13664",
|
||||
"EnabledAlFresco": "1",
|
||||
"CodEdizione": "1",
|
||||
"FasciaEta": "Genitori",
|
||||
"FasciaEta2": "Ragazze e ragazzi",
|
||||
"data": "2024-12-19 11:16:13.993",
|
||||
"DescrizioneStatoProdotto": "In prevendita",
|
||||
"Codice": "22753",
|
||||
"QtaDisponibile": "-2"
|
||||
}
|
||||
]</pre>Product:
|
||||
<pre>{
|
||||
"id": 73612,
|
||||
"name": "La storia di Flumeide e la bambina - Nuovo",
|
||||
"slug": "la-storia-di-flumeide-e-la-bambina-nuovo",
|
||||
"permalink": "https:\/\/www.fioredellavita.it\/?post_type=product&p=73611&attribute_pa_versione=nuovo",
|
||||
"date_created": "2024-11-20T04:49:10",
|
||||
"date_created_gmt": "2024-11-20T03:49:10",
|
||||
"date_modified": "2024-12-20T12:56:24",
|
||||
"date_modified_gmt": "2024-12-20T11:56:24",
|
||||
"type": "variation",
|
||||
"status": "publish",
|
||||
"featured": false,
|
||||
"catalog_visibility": "visible",
|
||||
"description": "",
|
||||
"short_description": "",
|
||||
"sku": "22753",
|
||||
"price": "12.3500",
|
||||
"regular_price": "13.0000",
|
||||
"sale_price": "12.3500",
|
||||
"date_on_sale_from": "2024-11-15T00:00:00",
|
||||
"date_on_sale_from_gmt": "2024-11-14T23:00:00",
|
||||
"date_on_sale_to": "2099-11-15T23:59:59",
|
||||
"date_on_sale_to_gmt": "2099-11-15T22:59:59",
|
||||
"on_sale": true,
|
||||
"purchasable": true,
|
||||
"total_sales": "0",
|
||||
"virtual": false,
|
||||
"downloadable": false,
|
||||
"downloads": [],
|
||||
"download_limit": -1,
|
||||
"download_expiry": -1,
|
||||
"external_url": "",
|
||||
"button_text": "",
|
||||
"tax_status": "taxable",
|
||||
"tax_class": "",
|
||||
"manage_stock": true,
|
||||
"stock_quantity": 10000,
|
||||
"backorders": "no",
|
||||
"backorders_allowed": false,
|
||||
"backordered": false,
|
||||
"low_stock_amount": null,
|
||||
"sold_individually": false,
|
||||
"weight": "",
|
||||
"dimensions": {
|
||||
"length": "",
|
||||
"width": "",
|
||||
"height": ""
|
||||
},
|
||||
"shipping_required": true,
|
||||
"shipping_taxable": true,
|
||||
"shipping_class": "",
|
||||
"shipping_class_id": 0,
|
||||
"reviews_allowed": false,
|
||||
"average_rating": "0.00",
|
||||
"rating_count": 0,
|
||||
"upsell_ids": [],
|
||||
"cross_sell_ids": [],
|
||||
"parent_id": 73611,
|
||||
"purchase_note": "",
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"images": [],
|
||||
"attributes": [
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Versione",
|
||||
"slug": "pa_versione",
|
||||
"option": "Nuovo"
|
||||
}
|
||||
],
|
||||
"default_attributes": [],
|
||||
"variations": [],
|
||||
"grouped_products": [],
|
||||
"menu_order": 1,
|
||||
"price_html": "<del aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>13,00<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/del> <span class="\"screen-reader-text\"">Il prezzo originale era: 13,00€.<\/span><ins aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>12,35<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/ins><span class="\"screen-reader-text\"">Il prezzo attuale \u00e8: 12,35€.<\/span>",
|
||||
"related_ids": [],
|
||||
"meta_data": [
|
||||
{
|
||||
"id": 1501793,
|
||||
"key": "ISBN",
|
||||
"value": "9788865934883"
|
||||
},
|
||||
{
|
||||
"id": 1501794,
|
||||
"key": "misure",
|
||||
"value": "cm 28x19"
|
||||
},
|
||||
{
|
||||
"id": 1501795,
|
||||
"key": "formato",
|
||||
"value": "Brossura"
|
||||
},
|
||||
{
|
||||
"id": 1501796,
|
||||
"key": "pagine",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"id": 1501798,
|
||||
"key": "_wpro_variable_is_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1501799,
|
||||
"key": "_is_pre_order",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521636,
|
||||
"key": "_pre_order_date",
|
||||
"value": "2025-01-21"
|
||||
},
|
||||
{
|
||||
"id": 1521637,
|
||||
"key": "_wpro_date_label_variable",
|
||||
"value": "Prenotalo per riceverlo entro il 21 gennaio 2025"
|
||||
},
|
||||
{
|
||||
"id": 1521638,
|
||||
"key": "_wpro_no_date_label_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521639,
|
||||
"key": "_wpro_manage_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521640,
|
||||
"key": "_wpro_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521641,
|
||||
"key": "_wpro_label_variable",
|
||||
"value": "Pre Ordinalo!"
|
||||
},
|
||||
{
|
||||
"id": 1521642,
|
||||
"key": "_wpro_price_type_variable",
|
||||
"value": "manual"
|
||||
},
|
||||
{
|
||||
"id": 1521643,
|
||||
"key": "_wpro_amount_price_variable",
|
||||
"value": "fixed"
|
||||
},
|
||||
{
|
||||
"id": 1521644,
|
||||
"key": "_wpro_date_variable",
|
||||
"value": "2025-01-21"
|
||||
},
|
||||
{
|
||||
"id": 1521645,
|
||||
"key": "_wpro_time_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521646,
|
||||
"key": "_rank_math_gtin_code",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521698,
|
||||
"key": "_ywpo_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521699,
|
||||
"key": "_ywpo_availability_date_mode",
|
||||
"value": "date"
|
||||
},
|
||||
{
|
||||
"id": 1521700,
|
||||
"key": "_ywpo_for_sale_date",
|
||||
"value": "1736809200"
|
||||
},
|
||||
{
|
||||
"id": 1521701,
|
||||
"key": "_ywpo_price_mode",
|
||||
"value": "default"
|
||||
},
|
||||
{
|
||||
"id": 1521702,
|
||||
"key": "_ywpo_preorder_price",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"id": 1521703,
|
||||
"key": "_ywpo_preorder_discount_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521704,
|
||||
"key": "_ywpo_preorder_discount_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521705,
|
||||
"key": "_ywpo_preorder_increase_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521706,
|
||||
"key": "_ywpo_preorder_increase_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521707,
|
||||
"key": "edizione",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"stock_status": "instock",
|
||||
"has_options": false,
|
||||
"post_password": "",
|
||||
"global_unique_id": "",
|
||||
"jetpack_sharing_enabled": true,
|
||||
"jetpack-related-posts": [],
|
||||
"builder_content": "",
|
||||
"_links": {
|
||||
"self": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73612",
|
||||
"targetHints": {
|
||||
"allow": [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"collection": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
|
||||
}
|
||||
],
|
||||
"up": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73611"
|
||||
}
|
||||
]
|
||||
}
|
||||
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
|
||||
<div id="loading" style="display: none;"></div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('articleForm');
|
||||
const result = document.getElementById('result');
|
||||
const loading = document.getElementById('loading');
|
||||
|
||||
const buttons = form.querySelectorAll('button');
|
||||
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
|
||||
|
||||
function handleButtonClick(event) {
|
||||
let action = event.target.dataset.action;
|
||||
let id = '0';
|
||||
try {
|
||||
id = form.querySelector('input[name="id"]').value;
|
||||
if (!action) {
|
||||
action = form.querySelector('input[name="action"]').value;
|
||||
}
|
||||
} catch (e) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
loading.style.display = 'block'; // Mostra la clessidra
|
||||
|
||||
let baseUrl = window.location.href;
|
||||
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
|
||||
|
||||
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
result.innerHTML = data;
|
||||
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>
|
||||
@@ -79,7 +79,7 @@ var mongoose = require('mongoose').set('debug', false);
|
||||
mongoose.set('debug', false);
|
||||
|
||||
const { CfgServer } = require('./models/cfgserver');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const populate = require('./populate/populate');
|
||||
const { Circuit } = require('./models/circuit');
|
||||
@@ -453,7 +453,7 @@ async function mystart() {
|
||||
function populateDBadmin() {
|
||||
const cfgserv = [
|
||||
{
|
||||
_id: new ObjectID(),
|
||||
_id: new ObjectId(),
|
||||
idapp: '9',
|
||||
chiave: 'vers',
|
||||
userId: 'ALL',
|
||||
@@ -599,7 +599,7 @@ async function inizia() {
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
||||
telegrambot.ADMIN_USER_SERVER,
|
||||
shared_consts.ADMIN_USER_SERVER,
|
||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
||||
|
||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
||||
|
||||
1
docs/test.htm
Normal file
@@ -0,0 +1 @@
|
||||
<div class="row align-start" style="gap:0px;flex-direction:column;flex:1;display:flex;justify-content:space-between;"><!-- Parte superiore --><div class="justify-start" style="flex-grow:0"><span style="font-size:calc(12 * var(--scalecatalog) * 1px)" class="book-author">{autore}</span><div style="font-size:calc(16 * var(--scalecatalog) * 1px);font-weight:bold;" class="book-title">{titolo}</div><span class="book-descr">{descrizione}</span></div><!-- Parte inferiore (book-details e barcode) --><div style="margin-top:auto;width:100%"><div class="justify-end book-details" style="flex-grow:0;font-size:calc(10 * var(--scalecatalog) * 1px);">Pagine: <b>{pagine}</b><br />Formato: <b>{misure}</b><br />Prezzo: <b>{prezzo} €</b><br /></div></div></div>
|
||||
44879
docs/test.js
@@ -2,7 +2,7 @@ module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "PRODUZIONE PiuCheBuono_ServerSide",
|
||||
script: "/var/www/www.freeplanet_server/src/server/server.js",
|
||||
script: "/var/www/nodejs_piuchebuono_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
//autorestart: true,
|
||||
|
||||
21
ecosystem.config.prod_freeplanet.app.js
Executable file
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "PRODUZIONE - FREEPLANET",
|
||||
script: "/var/www/www.freeplanet_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
//autorestart: true,
|
||||
instances: 1,
|
||||
watch: false,
|
||||
env: {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
log_file: "logs/combined.outerr.log",
|
||||
error_file: "logs/error.log",
|
||||
out_file: "logs/out.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
]
|
||||
};
|
||||
21
ecosystem.config.prod_riso.js
Executable file
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "PRODUZIONE RISO - FREEPLANET",
|
||||
script: "/var/www/nodejs_riso_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
//autorestart: true,
|
||||
instances: 1,
|
||||
watch: false,
|
||||
env: {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
log_file: "logs/combined.outerr.log",
|
||||
error_file: "logs/error.log",
|
||||
out_file: "logs/out.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -64,7 +64,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.price
|
||||
- var after_price = rec.order.after_price
|
||||
- var TotalPriceProduct = rec.order.TotalPriceProductstr
|
||||
@@ -118,7 +118,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -62,7 +62,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.product.price
|
||||
- var after_price = rec.order.product.after_price
|
||||
if (rec.order.gasordine)
|
||||
@@ -117,7 +117,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -45,7 +45,7 @@ html
|
||||
p Ciao #{mioname},
|
||||
p L'ordine n. #{ordernumber} è stato Consegnato correttamente 📦 !
|
||||
p Grazie per averci scelto 🙏🏻 e alla prossima !
|
||||
p
|
||||
p
|
||||
|
||||
if (orders.items[0].order.quantitypreordered > 0)
|
||||
- var miomakeorder = mystorehouse.email_html_GAS_order_consegnato
|
||||
@@ -61,7 +61,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.product.price
|
||||
- var after_price = rec.order.product.after_price
|
||||
if (rec.order.gasordine)
|
||||
@@ -116,7 +116,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
p Ciao #{name},
|
||||
p Hai ricevuto
|
||||
strong #{qty} #{symbol}
|
||||
| da parte di #{mittente} sul
|
||||
strong #{nomecircuito} !
|
||||
p Hai ricevuto
|
||||
strong #{qty} #{symbol}
|
||||
if groupDestoContoCom
|
||||
| sul conto
|
||||
strong #{groupDestoContoCom}
|
||||
span da parte di #{mittente} in data #{transactionDate} sul
|
||||
strong #{nomecircuito} !
|
||||
if causalDest
|
||||
p <br>
|
||||
p Descrizione: #{causalDest}
|
||||
if causale
|
||||
p <br>
|
||||
p Commento di #{mittente}: #{causale}
|
||||
p <br>
|
||||
p Apri #{nomeapp} per vedere il tuo nuovo saldo.
|
||||
p Apri
|
||||
strong <a href=#{strlinksito} target="_blank">#{nomeapp}</a>
|
||||
span per vedere il tuo nuovo saldo.
|
||||
p <br>
|
||||
p Cordiali Saluti
|
||||
p Supporto #{nomeapp}
|
||||
|
||||
116
logtrans.txt
@@ -304,4 +304,118 @@ BlediMakeru: 25.00 RIS]
|
||||
Dom 29/09 ORE 23:24: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (Anna50823) a franz12090 15 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (Anna50823): -397.00 RIS]
|
||||
franz12090: 20.00 RIS]
|
||||
franz12090: 20.00 RIS]
|
||||
Lun 30/09 ORE 22:42: [<b>Circuito RIS Italia</b>]: Inviate Monete da laura.nocera a Emilie 4 RIS [causale: carissima siccome ieri non ho potuto darli subito te li invio ora, inoltre un piccolo regalo per i tuoi bei figli per cui ti mando 4 ris invece che 2, un abbraccio e civediamo alla prossima ]
|
||||
Saldi:
|
||||
laura.nocera: -4.00 RIS]
|
||||
Emilie: 4.00 RIS]
|
||||
Lun 30/09 ORE 22:48: [<b>Circuito RIS Foggia</b>]: Inviate Monete da sergiomazzanti a pomps61 5 RIS [causale: ]
|
||||
Saldi:
|
||||
sergiomazzanti: 20.00 RIS]
|
||||
pomps61: 0.00 RIS]
|
||||
Lun 30/09 ORE 22:52: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (Anna50823) a Naanbe 15 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (Anna50823): -412.00 RIS]
|
||||
Naanbe: 3.00 RIS]
|
||||
Lun 30/09 ORE 22:54: [<b>Circuito RIS Bologna</b>]: Inviate Monete da ZeoPleiadi a pepedielena 1.5 RIS [causale: ]
|
||||
Saldi:
|
||||
ZeoPleiadi: 8.00 RIS]
|
||||
pepedielena: 1.50 RIS]
|
||||
Lun 30/09 ORE 22:55: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: Mio Commento !!! Ciaoooooooo.
|
||||
Ecome stai ????]
|
||||
Saldi:
|
||||
paoloar77: 21.00 RIS]
|
||||
ElenaEspx: 29.40 RIS]
|
||||
Lun 30/09 ORE 22:58: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 0.01 RIS [causale: Prova del commento. Ciaooo come stai . Tutto benekfaòjd ask dakisj dlaks jdlkas jdlakdklasj dlkas jdlasd]
|
||||
Saldi:
|
||||
paoloar77: 20.99 RIS]
|
||||
ElenaEspx: 29.41 RIS]
|
||||
Mer 02/10 ORE 00:26: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a PiuCheBuono(GaseBottega) 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 101.50 RIS]
|
||||
PiuCheBuono(GaseBottega): -64.50 RIS]
|
||||
Mer 02/10 ORE 00:51: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 100.50 RIS]
|
||||
TestTransazPao: 1.00 RIS]
|
||||
Mer 02/10 ORE 02:07: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: dsadasdada]
|
||||
Saldi:
|
||||
paoloar77: 95.50 RIS]
|
||||
TestTransazPao: 6.00 RIS]
|
||||
Mer 02/10 ORE 02:10: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: DSDA Ciaoooooooo]
|
||||
Saldi:
|
||||
paoloar77: 88.50 RIS]
|
||||
TestTransazPao: 13.00 RIS]
|
||||
Mer 02/10 ORE 02:16: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 0.5 RIS [causale: Miaooooooooo]
|
||||
Saldi:
|
||||
paoloar77: 88.00 RIS]
|
||||
TestTransazPao: 13.50 RIS]
|
||||
Mer 02/10 ORE 02:19: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: AAAAA]
|
||||
Saldi:
|
||||
paoloar77: 86.00 RIS]
|
||||
TestTransazPao: 15.50 RIS]
|
||||
Mer 02/10 ORE 02:21: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 85.00 RIS]
|
||||
TestTransazPao: 16.50 RIS]
|
||||
Mer 02/10 ORE 02:24: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 83.00 RIS]
|
||||
TestTransazPao: 18.50 RIS]
|
||||
Mer 02/10 ORE 02:25: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 19.99 RIS]
|
||||
ElenaEspx: 30.41 RIS]
|
||||
Mer 02/10 ORE 03:31: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 3 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 16.99 RIS]
|
||||
ElenaEspx: 33.41 RIS]
|
||||
Gio 03/10 ORE 15:13: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 14.99 RIS]
|
||||
TestTransazPao: 2.00 RIS]
|
||||
Ven 04/10 ORE 01:33: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Grazie Mille :D Un abbraccione tanto forte]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 12.99 RIS]
|
||||
ElenaEspx: 35.41 RIS]
|
||||
Ven 04/10 ORE 01:35: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Grazie di tutto]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 10.99 RIS]
|
||||
ElenaEspx: 37.41 RIS]
|
||||
Ven 04/10 ORE 01:36: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Ecco il mio commento]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 8.99 RIS]
|
||||
ElenaEspx: 39.41 RIS]
|
||||
Ven 04/10 ORE 01:50: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Altra prova aaaa]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 6.99 RIS]
|
||||
ElenaEspx: 41.41 RIS]
|
||||
Dom 27/10 ORE 23:50: [<b>Circuito RIS Foggia</b>]: Inviate Monete da sergiomazzanti a SamuelMast 10 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
sergiomazzanti: 10.00 RIS]
|
||||
SamuelMast: -76.00 RIS]
|
||||
Dom 27/10 ORE 23:55: [<b>Circuito RIS Campania</b>]: Inviate Monete da Unicorno_Giacomo a zacc50 16 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
Unicorno_Giacomo: 227.30 RIS]
|
||||
zacc50: -62.00 RIS]
|
||||
Dom 03/11 ORE 19:28: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: prova]
|
||||
|
||||
Saldi:
|
||||
paoloar77: 82.00 RIS]
|
||||
ElenaEspx: -49.10 RIS]
|
||||
Dom 03/11 ORE 19:32: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: provaaaa]
|
||||
|
||||
Saldi:
|
||||
paoloar77: 81.00 RIS]
|
||||
ElenaEspx: -48.10 RIS]
|
||||
Gio 09/01 ORE 17:04: [<b>Circuito RIS TerraNFT</b>]: Inviate Monete da terranft (paoloar77) a SuryaArena 30 RIS [causale: Iniziale]
|
||||
|
||||
Saldi:
|
||||
terranft (paoloar77): -30.00 RIS]
|
||||
SuryaArena: 30.00 RIS]
|
||||
@@ -33,6 +33,7 @@
|
||||
"email-templates": "^10.0.1",
|
||||
"express": "^4.18.1",
|
||||
"formidable": "^2.0.1",
|
||||
"ghostscript4js": "^3.2.3",
|
||||
"i18n": "^0.15.0",
|
||||
"image-downloader": "^4.3.0",
|
||||
"internet-available": "^1.0.0",
|
||||
@@ -42,6 +43,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"mongodb": "^4.4.1",
|
||||
"mongoose": "^5.13.15",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"mysql": "^2.18.1",
|
||||
"node-cron": "^3.0.2",
|
||||
"node-emoji": "^1.11.0",
|
||||
@@ -51,6 +53,8 @@
|
||||
"node-telegram-bot-api": "^0.65.1",
|
||||
"nodemailer": "^6.7.8",
|
||||
"npm-check-updates": "^16.14.18",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdf-parse": "^1.1.1",
|
||||
"pem": "^1.14.6",
|
||||
"preview-email": "^3.0.7",
|
||||
"pug": "^3.0.2",
|
||||
@@ -64,6 +68,7 @@
|
||||
"validator": "^13.7.0",
|
||||
"vhost": "^3.0.2",
|
||||
"web-push": "^3.6.7",
|
||||
"xml2js": "^0.6.2",
|
||||
"xoauth2": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
source ./.env.prod.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... /var/www/$SERVERDIR_WEBSITE/"
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $SERVERDIR_WEBSITE/"
|
||||
echo ""
|
||||
|
||||
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:$SERVERDIR_WEBSITE/
|
||||
|
||||
echo "Sincronizzazione TERMINATA! - SERVER PCB!"
|
||||
|
||||
BIN
public/upload/catalogo/Paolo_stampa_2664x3685.jpg
Normal file
|
After Width: | Height: | Size: 554 KiB |
BIN
public/upload/imgs/background_stampa.jpg
Normal file
|
After Width: | Height: | Size: 3.2 MiB |
BIN
public/upload/pages/home/gruppo_macro.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
public/upload/pages/home/logo-new-121x121_gaia_terra.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/upload/pages/undefined/gruppo_macro.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
public/upload/products/LQ_Letsee_100x1120jpeg.jpg
Normal file
|
After Width: | Height: | Size: 629 KiB |
BIN
public/upload/products/avocado2.jpg
Normal file
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 678 KiB |
@@ -63583,7 +63583,7 @@ module.exports = {
|
||||
{
|
||||
_id: 5782,
|
||||
istat: '030096',
|
||||
comune: 'Rivignano',
|
||||
comune: 'Rivignano Teor',
|
||||
prov: 'UD',
|
||||
reg: 'FVG',
|
||||
pref: '0432',
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
"CIRCUIT_REQUEST_TO_ENTER": "%s ha chiesto di entrare nel circuito %s",
|
||||
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
||||
"CIRCUIT_REQUEST": "Richiesta di entrare nel Circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "Sei stato aggiunto come Amministratore del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore/Amministratrice del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "Sei stato aggiunto come Amministratore/Amministratrice del circuito %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del circuito %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN_YOU": "Ti è stato rimosso l'incarico di Amministratore del circuito %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il Circuito %s da parte di %s",
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
"Good": "Bene",
|
||||
"Service": "Servizio",
|
||||
"Hosp": "Ospitalità",
|
||||
"Hosp %s": "Ospitalità: %s",
|
||||
"Event": "Evento",
|
||||
"Good: %s": "Bene: %s",
|
||||
"Service: %s": "Servizio: %s",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong>",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong> a %s",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong> a %s",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong> a %s",
|
||||
"NEW_EVENT": "❇️ <strong>%s</strong> ha aggiunto un nuovo Evento: \n%s\n<strong>%s</strong>\n%s",
|
||||
"NEW_EVENT_TELEGRAM": "%s\n\n❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
"NEW_ANNUNCIO_TELEGRAM": "❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
@@ -37,8 +39,8 @@
|
||||
"GROUP_REQUEST_TO_ENTER": "%s ha chiesto di entrare nel gruppo %s",
|
||||
"GROUP_CREATED": "✅ %s ha creato un nuovo Gruppo chiamato %s",
|
||||
"GROUP_REQUEST": "Richiesta di entrare nel Gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP": "E' stato aggiunto %s come Amministratore del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP_YOU": "Sei stato aggiunto come Amministratore del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP": "E' stato aggiunto %s come Amministratore/Amministratrice del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP_YOU": "Sei stato aggiunto come Amministratore/Amministratrice del gruppo %s da parte di %s",
|
||||
"GROUPS_REMOVED_ADMIN_GROUP": "E' stato rimosso l'incarico di Amministratore a %s del gruppo %s da parte di %s",
|
||||
"GROUPS_REMOVED_ADMIN_GROUP_YOU": "Ti è stato rimosso l'incarico di Amministratore del gruppo %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_GRUPPO": "Richiesta di bloccare il Gruppo %s da parte di %s",
|
||||
@@ -51,16 +53,21 @@
|
||||
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍♂️ Abilita Fiducia a %s nel '%s':",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍♂️ Abilita Fiducia nel Circuito al gruppo %s:",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_CIRC": "❇️👥 🧍♂️ Fai entrare a %s nel '%s':",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP_CIRC": "❇️👥 🧍♂️ Fai entrare nel Circuito al gruppo %s:",
|
||||
"CIRCUIT_OPEN_RISITALIA": "Apri il Circuito RIS Italia e chiedi di entrare",
|
||||
"CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s (con %s iscritti) ed è in attesa di essere abilitato alla Fiducia\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_SHORT": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_TITLE": "++ Nuova Richiesta di %s",
|
||||
"CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s",
|
||||
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s (con %s iscritti)",
|
||||
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
||||
"CIRCUIT_REQUEST": "Richiesta di entrare nel %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "%s sei stato aggiunto come Amministratore del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore/Amministratrice del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "%s sei stato aggiunto come Amministratore/Amministratrice del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore/Amministratrice a %s del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN_YOU": "%s ti è stato rimosso l'incarico di Amministratore del %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il %s da parte di %s",
|
||||
"CIRCUIT_ELIMINATO": "Il %s è stato eliminato da parte di %s",
|
||||
@@ -87,14 +94,14 @@
|
||||
"CIRCUIT_SENDCOINSREQ_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) sta inviando <strong>%s %s</strong> al conto %s '%s' sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_ME": "Stai inviando <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_GROUP": "Stai inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "Hai ricevuto <strong>%s %s</strong> dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "Hai ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "<strong>%s %s</strong> ricevuti da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "🟢 Hai ricevuto <strong>%s %s</strong> dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "🟢 il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "🟢 il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "🟢 Hai ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "🟢 <strong>%s %s</strong> ricevuti da %s sul '%s'.",
|
||||
"SALDO_UPDATE": "[Saldo <strong>%s %s</strong> sul '%s']",
|
||||
"SALDO_UPDATE_WHO": "[Saldo %s <strong>%s %s</strong> sul '%s']",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "🔄 Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED": "%s %s rifiutati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED_TO_ME": "%s %s rifiutati da %s sul '%s'.",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "L'importo supera la quantità massima concessa per %s",
|
||||
@@ -114,10 +121,11 @@
|
||||
"DATE_2DAYS": "%s dalle %s fino a %s alle %s",
|
||||
"SENDMSG_ENTRA_IN_RISO_ITALIA": "Ciao %s!<br>%s che appartiene al <em>%s</em> vuole inviarti dei RIS. Per poterli ricevere dovete entrambi utilizzare il <strong>Circuito RIS Italia</strong>.",
|
||||
"CLICCA_QUI": "CLICCA QUI",
|
||||
"✅ %s è stato Abilitato correttamente (da %s)!": "✅ %s è stato Abilitato correttamente (da %s)!",
|
||||
"✅ Sei stato Abilitato correttamente da %s!": "✅ Sei stato Abilitato correttamente da %s!",
|
||||
"✅ %s è stato Ammesso correttamente (da %s)!": "✅ %s è stato Ammesso correttamente (da %s)!",
|
||||
"✅ Sei stato Ammesso correttamente da %s!": "✅ Sei stato Ammesso correttamente da %s!",
|
||||
"🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!": "🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!",
|
||||
"🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.",
|
||||
"🚫 %s ha rifiutato l'accesso alla App a %s !": "🚫 %s ha rifiutato l'accesso alla App a %s !",
|
||||
"✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !"
|
||||
}
|
||||
"✅ Hai Ammesso l'accesso alla App a %s !": "✅ Hai Ammesso l'accesso alla App a %s !",
|
||||
"Good: %": "Good: %"
|
||||
}
|
||||
@@ -63,7 +63,7 @@ const authenticate = (req, res, next) => {
|
||||
|
||||
}).catch((e) => {
|
||||
if (e === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||
}
|
||||
tools.mylog("ERR authenticate invalid Token =", e);
|
||||
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
||||
@@ -90,14 +90,18 @@ const authenticate_noerror = (req, res, next) => {
|
||||
req.access = access;
|
||||
req.code = ris.code;
|
||||
}
|
||||
// Vai avanti ad eseguire il codice, in ogni modo !
|
||||
next();
|
||||
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.token = null;
|
||||
req.access = null;
|
||||
req.code = 0;
|
||||
|
||||
|
||||
// Continua comunque !
|
||||
next();
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
@@ -24,7 +24,7 @@ const AccountSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -105,7 +105,7 @@ AccountSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
AccountSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID().toString();
|
||||
this._id = new ObjectId().toString();
|
||||
}
|
||||
|
||||
next();
|
||||
@@ -235,11 +235,11 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
|
||||
myaccount.totTransato = 0;
|
||||
}
|
||||
myaccount.totTransato += Math.abs(amount);
|
||||
|
||||
|
||||
if (!myaccount.numtransactions)
|
||||
myaccount.numtransactions = 0;
|
||||
myaccount.numtransactions++;
|
||||
|
||||
|
||||
myaccount.date_updated = new Date();
|
||||
|
||||
myaccountupdate.saldo = myaccount.saldo;
|
||||
@@ -255,7 +255,9 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
|
||||
// Calcola Saldo Pendente !
|
||||
await myaccount.calcPending(true);
|
||||
|
||||
return ris;
|
||||
const recupdated = await Account.findOne({ _id: myaccount.id });
|
||||
|
||||
return recupdated;
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -304,7 +306,7 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
|
||||
if (!myaccount && createifnotexist) {
|
||||
myaccount = new Account({
|
||||
_id: new ObjectID().toString(),
|
||||
_id: new ObjectId().toString(),
|
||||
idapp,
|
||||
username: (!groupname && !contocom) ? username : '',
|
||||
groupname,
|
||||
@@ -322,8 +324,9 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
});
|
||||
|
||||
if (contocom) {
|
||||
myaccount.fidoConcesso = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
|
||||
myaccount.qta_maxConcessa = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
|
||||
myaccount.fidoConcesso = mycircuit.fido_scoperto_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
|
||||
myaccount.qta_maxConcessa = mycircuit.qta_max_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
|
||||
|
||||
} else {
|
||||
if (!mycircuit.fido_scoperto_default_grp)
|
||||
mycircuit.fido_scoperto_default_grp = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_GRP;
|
||||
@@ -343,7 +346,13 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
myaccount.fidoConcesso = 0;
|
||||
}
|
||||
|
||||
return await myaccount.save();
|
||||
let acc = await myaccount.save();
|
||||
|
||||
if (mycircuit.creditodiPartenza && mycircuit.creditodiPartenza > 0) {
|
||||
acc = await Account.addtoSaldo(acc, mycircuit.creditodiPartenza, false);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
return myaccount;
|
||||
@@ -605,8 +614,12 @@ AccountSchema.statics.SetMinMaxPersonali = async function (idapp, fidoConcesso,
|
||||
}
|
||||
});
|
||||
|
||||
// Se aggiorno questi dati, allora devo aggiornare anche gli account del RIS Nazionale
|
||||
await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
|
||||
const circuit = await Circuit.findOne({ _id: circuitId });
|
||||
|
||||
if (!circuit.circuitoIndipendente) {
|
||||
// Se aggiorno questi dati, e non è un Circuito Indipendente, allora devo aggiornare anche gli account del RIS Nazionale
|
||||
await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
|
||||
}
|
||||
|
||||
} else {
|
||||
const ris = await Account.updateMany({ idapp, fidoConcesso: { $gt: 0 }, username: { "$nin": [null, ""] } },
|
||||
@@ -690,9 +703,9 @@ AccountSchema.statics.updateAccountCircuitoNazionaleByLimiti = async function (i
|
||||
} catch (e) {
|
||||
console.error('updateAccountCircuitoNazionaleByLimiti', e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
};
|
||||
|
||||
AccountSchema.statics.canEditAccountAdmins = async function (username, id) {
|
||||
@@ -736,7 +749,7 @@ AccountSchema.statics.removeAdminOfAccount = async function (idapp, username, ci
|
||||
// Rimuovi l'account
|
||||
AccountSchema.statics.removeAccount = async function (accountId) {
|
||||
|
||||
return await Account.deleteOne({ _id: accountId});
|
||||
return await Account.deleteOne({ _id: accountId });
|
||||
};
|
||||
|
||||
AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -11,7 +11,9 @@ const { MyGroup } = require('./mygroup');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_ATTIVITAS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -24,7 +26,7 @@ const AttivitaSchema = new Schema(
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -129,7 +131,7 @@ const AttivitaSchema = new Schema(
|
||||
//**ADDFIELD_ATTIVITA
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
}, { strict: false });
|
||||
|
||||
AttivitaSchema.index({ 'idapp': 1 });
|
||||
@@ -182,7 +184,7 @@ AttivitaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -236,7 +238,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -262,7 +264,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -288,7 +290,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
@@ -306,7 +308,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -339,7 +341,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -19,6 +19,9 @@ const CatProdSchema = new Schema({
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
descr_estesa: {
|
||||
type: String,
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const { Movement } = require('../models/movement');
|
||||
const { Account } = require('../models/account');
|
||||
@@ -26,7 +26,7 @@ const CircuitSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -127,6 +127,12 @@ const CircuitSchema = new Schema({
|
||||
qta_max_default_grp: {
|
||||
type: Number,
|
||||
},
|
||||
fido_scoperto_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
qta_max_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
data_costituz: {
|
||||
type: Date,
|
||||
},
|
||||
@@ -229,11 +235,27 @@ const CircuitSchema = new Schema({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
askManagerToEnter: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
sendEmailAfterAskingToEnter: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
circuitoIndipendente: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
creditodiPartenza: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
CircuitSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID().toString();
|
||||
this._id = new ObjectId().toString();
|
||||
|
||||
this.date_created = new Date();
|
||||
}
|
||||
@@ -248,7 +270,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const whatToShow = this.getWhatToShow(idapp, '');
|
||||
|
||||
return await Circuit.find(myfind, whatToShow).sort({ status: -1, numMembers: -1, name: 1 });
|
||||
return await Circuit.find(myfind, whatToShow).lean().sort({ name: 1 });
|
||||
};
|
||||
|
||||
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||
@@ -300,8 +322,15 @@ CircuitSchema.statics.getWhatToShow = function (idapp, username) {
|
||||
qta_max_default: 1,
|
||||
fido_scoperto_default_grp: 1,
|
||||
qta_max_default_grp: 1,
|
||||
fido_scoperto_default_contocom: 1,
|
||||
qta_max_default_contocom: 1,
|
||||
deperimento: 1,
|
||||
showAlways: 1,
|
||||
ignoreLimits: 1,
|
||||
askManagerToEnter: 1,
|
||||
sendEmailAfterAskingToEnter: 1,
|
||||
circuitoIndipendente: 1,
|
||||
creditodiPartenza: 1,
|
||||
transactionsEnabled: 1,
|
||||
status: 1,
|
||||
valuta_per_euro: 1,
|
||||
@@ -359,6 +388,11 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
regulation: 1,
|
||||
numMembers: 1,
|
||||
showAlways: 1,
|
||||
ignoreLimits: 1,
|
||||
askManagerToEnter: 1,
|
||||
sendEmailAfterAskingToEnter: 1,
|
||||
circuitoIndipendente: 1,
|
||||
creditodiPartenza: 1,
|
||||
systemUserId: 1,
|
||||
founderUserId: 1,
|
||||
nome_valuta: 1,
|
||||
@@ -367,6 +401,8 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
fido_scoperto_default: 1,
|
||||
fido_scoperto_default_grp: 1,
|
||||
qta_max_default_grp: 1,
|
||||
fido_scoperto_default_contocom: 1,
|
||||
qta_max_default_contocom: 1,
|
||||
qta_max_default: 1,
|
||||
valuta_per_euro: 1,
|
||||
symbol: 1,
|
||||
@@ -394,7 +430,7 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
};
|
||||
};
|
||||
|
||||
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user) {
|
||||
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user, nummovTodownload) {
|
||||
|
||||
try {
|
||||
const { User } = require('../models/user');
|
||||
@@ -420,7 +456,7 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).sort({ status: -1, numMembers: -1, name: 1 }).lean();
|
||||
}, whatToShow_Unknown).sort({ name: 1 }).lean();
|
||||
|
||||
let asked_circuits = await Circuit.find({
|
||||
idapp,
|
||||
@@ -442,12 +478,15 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).sort({ status: -1 }).lean();
|
||||
|
||||
const last_my_transactions = await Movement.getLastN_Transactions(idapp, nummovTodownload, username, '');
|
||||
|
||||
return {
|
||||
listcircuits,
|
||||
asked_circuits,
|
||||
refused_circuits,
|
||||
manage_mycircuits,
|
||||
mycircuits: user.profile.mycircuits,
|
||||
last_my_transactions,
|
||||
};
|
||||
|
||||
} catch (e) {
|
||||
@@ -484,6 +523,16 @@ CircuitSchema.statics.getInfoCircuitByName = async function (idapp, name) {
|
||||
|
||||
CircuitSchema.statics.getCircuitByName = async function (idapp, name) {
|
||||
|
||||
if (name === 'Circuito RIS Benevento') {
|
||||
name = 'Circuito RIS Campania';
|
||||
} else if (name === 'RIS Pesaro e Urbino') {
|
||||
name = 'Circuito RIS Pesaro e Urbino';
|
||||
} else if (name === 'RIS Catania') {
|
||||
name = 'Circuito RIS Catania';
|
||||
} else if (name === 'RIS Palermo') {
|
||||
name = 'Circuito RIS Palermo';
|
||||
}
|
||||
|
||||
const myfind = {
|
||||
idapp,
|
||||
name,
|
||||
@@ -664,6 +713,8 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const { MyGroup } = require('./mygroup');
|
||||
|
||||
const sendemail = require('../sendemail');
|
||||
|
||||
let ris = {
|
||||
@@ -728,7 +779,7 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
if (!onlycheck) {
|
||||
// Add a Transaction !
|
||||
if (ris.cansend) {
|
||||
ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.notifId, extrarec.idOrdersCart);
|
||||
ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.causalDest, extrarec.notifId, extrarec.idOrdersCart);
|
||||
}
|
||||
|
||||
if (ris.cansend && ris.rec) {
|
||||
@@ -759,8 +810,9 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
let dest = (extrarec.dest ? extrarec.dest : '') + (extrarec.groupdest ? extrarec.groupdest : '') + (extrarec.contoComDest ? extrarec.contoComDest : '');
|
||||
|
||||
ris.result = true;
|
||||
let causalDest = extrarec.causalDest ? 'Causale Destinatario: ' + extrarec.causalDest : ''
|
||||
let msg = '[<b>' + circuittable.name + '</b>]: Inviate Monete da ' + orig + ' a ' + dest + ' ' + myqty + ' ' + circuittable.symbol + ' [causale: ' + extrarec.causal +
|
||||
`]\nSaldi:\n${orig}: ` + extrarec.saldoOrig + ' ' + circuittable.symbol + '] ' + `\n${dest}: ` + extrarec.saldoDest + ' ' + circuittable.symbol + ']';
|
||||
`]\n` + causalDest+ `\nSaldi:\n${orig}: ` + extrarec.saldoOrig + ' ' + circuittable.symbol + '] ' + `\n${dest}: ` + extrarec.saldoDest + ' ' + circuittable.symbol + ']';
|
||||
console.log(msg);
|
||||
|
||||
ris.useraccounts = await Account.getUserAccounts(idapp, usernameOrig);
|
||||
@@ -772,23 +824,33 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
let mittente = orig;
|
||||
|
||||
try {
|
||||
const paramsrec = {
|
||||
mittente, nomecircuito: circuittable.name,
|
||||
symbol: circuittable.symbol, qty: myqty,
|
||||
transactionDate: ris.rec.transactionDate,
|
||||
causale: extrarec.causal,
|
||||
causalDest: extrarec.causalDest,
|
||||
};
|
||||
if (extrarec.dest) {
|
||||
let myuserDest = await User.getUserByUsername(idapp, extrarec.dest);
|
||||
|
||||
// Invia una email al destinatario !
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, { mittente, nomecircuito: circuittable.name, symbol: circuittable.symbol, qty: myqty });
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, paramsrec);
|
||||
|
||||
} else if (extrarec.groupdest || extrarec.contoComDest) {
|
||||
const groupDestoContoCom = extrarec.groupdest ? extrarec.groupdest : (extrarec && extrarec.contoComDest ? extrarec.contoComDest : '');
|
||||
let arrusers = await MyGroup.getListAdminsByGroupName(idapp, groupDestoContoCom);
|
||||
if (arrusers.length <= 0)
|
||||
arrusers = await Circuit.getListAdminsByCircuitPath(idapp, groupDestoContoCom);
|
||||
|
||||
paramsrec.groupDestoContoCom = groupDestoContoCom;
|
||||
|
||||
for (let i = 0; i < arrusers.length; i++) {
|
||||
|
||||
let myuserDest = await User.getUserByUsername(idapp, arrusers[i].username);
|
||||
|
||||
// Invia una email al destinatario !
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, { mittente, nomecircuito: circuittable.name, symbol: circuittable.symbol, qty: myqty });
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, paramsrec);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -914,6 +976,15 @@ CircuitSchema.statics.getNameByCircuitId = async function (circuitId) {
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
CircuitSchema.statics.getPathByCircuitName = async function (idapp, circuitName) {
|
||||
|
||||
let circuit = await Circuit.findOne({ idapp, name: circuitName }).lean();
|
||||
if (circuit)
|
||||
return '/' + shared_consts.getDirectoryByTable('circuits') + '/' + circuit.path;
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
|
||||
CircuitSchema.statics.getCircuitByCircuitId = async function (circuitId) {
|
||||
@@ -1036,7 +1107,7 @@ CircuitSchema.statics.getCircuitMyProvince = async function (idapp, username) {
|
||||
CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, province, card) {
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const useradmin = tools.USER_ADMIN_CIRCUITS;
|
||||
const useradmin = shared_consts.USER_ADMIN_CIRCUITS;
|
||||
|
||||
let myrec = null;
|
||||
try {
|
||||
@@ -1067,6 +1138,9 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
|
||||
totCircolante: 0,
|
||||
date_created: new Date(),
|
||||
admins: [{ username: useradmin }],
|
||||
askManagerToEnter: false,
|
||||
sendEmailAfterAskingToEnter: false,
|
||||
circuitoIndipendente: false,
|
||||
});
|
||||
|
||||
myrec = await circ.save();
|
||||
@@ -1709,6 +1783,7 @@ CircuitSchema.statics.addMovementByOrdersCart = async function (ordersCart, user
|
||||
dest: usernameDest,
|
||||
groupdest: groupDest,
|
||||
contoComDest: '',
|
||||
causalDest: '',
|
||||
};
|
||||
|
||||
const usernameOrig = await User.getUsernameById(idapp, ordersCart.userId);
|
||||
|
||||
@@ -8,7 +8,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const fs = require('fs-extra');
|
||||
|
||||
|
||||
60
src/server/models/collana.js
Executable file
@@ -0,0 +1,60 @@
|
||||
mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const CollanaSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
idCollana: {
|
||||
type: Number,
|
||||
},
|
||||
descrizione: {
|
||||
type: String,
|
||||
},
|
||||
Descrizione_Estesa: {
|
||||
type: String,
|
||||
},
|
||||
dataOra: {
|
||||
type: Date,
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
},
|
||||
enabledAlFresco: {
|
||||
type: Boolean,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var Collana = module.exports = mongoose.model('Collana', CollanaSchema);
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [
|
||||
{ field: 'descrizione', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Collana.find(myfind).sort({name: 1, surname: 1});
|
||||
};
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ const _ = require('lodash');
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const { Settings } = require('./settings');
|
||||
|
||||
@@ -226,7 +226,7 @@ function addRecGraduatoria(idapp, ingr, index) {
|
||||
|
||||
try {
|
||||
let rec = new Graduatoria({
|
||||
_id: new ObjectID(),
|
||||
_id: new ObjectId(),
|
||||
idapp,
|
||||
idListaIngresso: ingr._id,
|
||||
ind_order: ingr.ind_order,
|
||||
|
||||
@@ -12,9 +12,7 @@ mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
var ObjectId = mongoose.Types.ObjectId;
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const HoursSchema = new Schema({
|
||||
idapp: {
|
||||
|
||||
63
src/server/models/importadescr.js
Executable file
@@ -0,0 +1,63 @@
|
||||
mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
// A1P
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const ImportaDescrSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
_id: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var ImportaDescr = module.exports = mongoose.model('ImportaDescr', ImportaDescrSchema);
|
||||
|
||||
ImportaDescrSchema.index({ idapp: 1 });
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [
|
||||
{ field: 'name', type: tools.FieldType.string },
|
||||
{ field: 'description', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
module.exports.getImportaDescrByCode = function (idapp, code) {
|
||||
return ImportaDescr.findAllIdApp(idapp, code);
|
||||
}
|
||||
|
||||
module.exports.getImportaDescrById = async function (id) {
|
||||
const arrris = await ImportaDescr.findAllIdApp('', '', id);
|
||||
return arrris && arrris.length > 0 ? arrris[0] : null
|
||||
}
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const ImportaDescr = this;
|
||||
|
||||
const myfind = { idapp, deleted: false };
|
||||
|
||||
return await ImportaDescr.find(myfind, (err, arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
};
|
||||
63
src/server/models/importaisbn.js
Executable file
@@ -0,0 +1,63 @@
|
||||
mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
// A1P
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const ImportaIsbnSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
_id: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var ImportaIsbn = module.exports = mongoose.model('ImportaIsbn', ImportaIsbnSchema);
|
||||
|
||||
ImportaIsbnSchema.index({ idapp: 1 });
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [
|
||||
{ field: 'name', type: tools.FieldType.string },
|
||||
{ field: 'description', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
module.exports.getImportaIsbnByCode = function (idapp, code) {
|
||||
return ImportaIsbn.findAllIdApp(idapp, code);
|
||||
}
|
||||
|
||||
module.exports.getImportaIsbnById = async function (id) {
|
||||
const arrris = await ImportaIsbn.findAllIdApp('', '', id);
|
||||
return arrris && arrris.length > 0 ? arrris[0] : null
|
||||
}
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const ImportaIsbn = this;
|
||||
|
||||
const myfind = { idapp, deleted: false };
|
||||
|
||||
return await ImportaIsbn.find(myfind, (err, arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
};
|
||||
@@ -5,7 +5,7 @@ const tools = require('../tools/general');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
@@ -5,7 +5,7 @@ const tools = require('../tools/general');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
const { Account } = require('../models/account');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
@@ -18,7 +18,7 @@ const MovementSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -50,6 +50,10 @@ const MovementSchema = new Schema({
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
causalDest: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
residual: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
@@ -95,7 +99,7 @@ MovementSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, 0, params);
|
||||
};
|
||||
|
||||
MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accountToIdTable, amount, causal, notifId, idOrdersCart) {
|
||||
MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accountToIdTable, amount, causal, causalDest, notifId, idOrdersCart) {
|
||||
|
||||
try {
|
||||
// Only positive values
|
||||
@@ -110,6 +114,7 @@ MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accou
|
||||
idOrdersCart,
|
||||
amount,
|
||||
causal,
|
||||
causalDest,
|
||||
residual: 0,
|
||||
notifId,
|
||||
// expiringDate:
|
||||
@@ -137,6 +142,8 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function (idapp, username
|
||||
}
|
||||
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, true, groupname, contocom);
|
||||
|
||||
|
||||
|
||||
if (myaccount) {
|
||||
|
||||
let aggr1 = [
|
||||
@@ -363,6 +370,7 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function (idapp, username
|
||||
transactionDate: 1,
|
||||
amount: 1,
|
||||
causal: 1,
|
||||
causalDest: 1,
|
||||
notifId: 1,
|
||||
'circuitfrom.symbol': 1,
|
||||
'circuitto.symbol': 1,
|
||||
@@ -640,6 +648,7 @@ MovementSchema.statics.getQueryAllUsersMovsByCircuitId = async function (idapp,
|
||||
transactionDate: 1,
|
||||
amount: 1,
|
||||
causal: 1,
|
||||
causalDest: 1,
|
||||
notifId: 1,
|
||||
'circuitfrom.symbol': 1,
|
||||
'circuitto.symbol': 1,
|
||||
@@ -741,24 +750,48 @@ MovementSchema.statics.checkIfCoinsAlreadySent = async function (notifId) {
|
||||
|
||||
};
|
||||
|
||||
MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz = 10) {
|
||||
MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz = 10, username = '', groupname = '', contocom = '') {
|
||||
const MyMovement = this;
|
||||
|
||||
// get last "numtransaz" transactions
|
||||
|
||||
let abilitaquerypersingolo = (username || groupname || contocom);
|
||||
|
||||
let querym2 = null;
|
||||
|
||||
if (abilitaquerypersingolo) {
|
||||
let v1 = [];
|
||||
|
||||
if (username) {
|
||||
v1.push({ 'userfrom.username': username },
|
||||
{ 'userto.username': username });
|
||||
}
|
||||
|
||||
if (groupname) {
|
||||
v1.push({ 'groupfrom.groupname': groupname },
|
||||
{ 'groupto.groupname': groupname });
|
||||
}
|
||||
if (contocom) {
|
||||
v1.push({ 'contocomfrom.name': contocom },
|
||||
{ 'contocomto.name': contocom });
|
||||
}
|
||||
|
||||
querym2 = {
|
||||
$match:
|
||||
{ $or: v1 }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
let aggr1 = [
|
||||
{
|
||||
$match: {
|
||||
idapp,
|
||||
},
|
||||
$match: { idapp },
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
transactionDate: -1,
|
||||
}
|
||||
},
|
||||
{ $limit: numtransaz },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'accounts',
|
||||
@@ -968,40 +1001,47 @@ MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project:
|
||||
{
|
||||
transactionDate: 1,
|
||||
amount: 1,
|
||||
causal: 1,
|
||||
notifId: 1,
|
||||
'circuitfrom.symbol': 1,
|
||||
'circuitfrom.name': 1,
|
||||
'circuitto.symbol': 1,
|
||||
'circuitto.name': 1,
|
||||
'userfrom.verified_by_aportador': 1,
|
||||
'userfrom.username': 1,
|
||||
'userfrom.profile.img': 1,
|
||||
'userto.username': 1,
|
||||
'userto.profile.img': 1,
|
||||
'userto.verified_by_aportador': 1,
|
||||
'groupfrom.groupname': 1,
|
||||
'groupfrom.verified_by_aportador': 1,
|
||||
'groupfrom.title': 1,
|
||||
'groupfrom.photos': 1,
|
||||
'groupto.groupname': 1,
|
||||
'groupto.title': 1,
|
||||
'groupto.photos': 1,
|
||||
'groupto.verified_by_aportador': 1,
|
||||
'contocomfrom.path': 1,
|
||||
'contocomfrom.name': 1,
|
||||
'contocomto.path': 1,
|
||||
'contocomto.name': 1,
|
||||
},
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
if (querym2)
|
||||
aggr1.push(querym2);
|
||||
|
||||
if (numtransaz)
|
||||
aggr1.push({ $limit: numtransaz });
|
||||
|
||||
aggr1.push({
|
||||
$project:
|
||||
{
|
||||
transactionDate: 1,
|
||||
amount: 1,
|
||||
causal: 1,
|
||||
causalDest: 1,
|
||||
notifId: 1,
|
||||
'circuitfrom.symbol': 1,
|
||||
'circuitfrom.name': 1,
|
||||
'circuitto.symbol': 1,
|
||||
'circuitto.name': 1,
|
||||
'userfrom.verified_by_aportador': 1,
|
||||
'userfrom.username': 1,
|
||||
'userfrom.profile.img': 1,
|
||||
'userto.username': 1,
|
||||
'userto.profile.img': 1,
|
||||
'userto.verified_by_aportador': 1,
|
||||
'groupfrom.groupname': 1,
|
||||
'groupfrom.verified_by_aportador': 1,
|
||||
'groupfrom.title': 1,
|
||||
'groupfrom.photos': 1,
|
||||
'groupto.groupname': 1,
|
||||
'groupto.title': 1,
|
||||
'groupto.photos': 1,
|
||||
'groupto.verified_by_aportador': 1,
|
||||
'contocomfrom.path': 1,
|
||||
'contocomfrom.name': 1,
|
||||
'contocomto.path': 1,
|
||||
'contocomto.name': 1,
|
||||
},
|
||||
});
|
||||
|
||||
const lastNtransac = await MyMovement.aggregate(aggr1);
|
||||
|
||||
/*
|
||||
@@ -1013,9 +1053,16 @@ MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz
|
||||
circuito: string
|
||||
amount: number
|
||||
causale: string
|
||||
|
||||
|
||||
*/
|
||||
|
||||
lastNtransac.forEach(function (mov) {
|
||||
let ris = tools.getStringaConto(mov)
|
||||
mov.userfrom = ris.userfrom
|
||||
mov.userto = ris.userto
|
||||
mov.tipocontofrom = ris.tipocontofrom
|
||||
mov.tipocontoto = ris.tipocontoto
|
||||
});
|
||||
|
||||
return lastNtransac;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { Reaction } = require('./reaction');
|
||||
@@ -24,7 +24,7 @@ const MyBachecaSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -64,6 +64,9 @@ const MyBachecaSchema = new Schema({
|
||||
contact_phone: {
|
||||
type: String
|
||||
},
|
||||
contact_email: {
|
||||
type: String
|
||||
},
|
||||
contact_telegram: {
|
||||
type: String
|
||||
},
|
||||
@@ -120,7 +123,7 @@ const MyBachecaSchema = new Schema({
|
||||
},
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
});
|
||||
|
||||
MyBachecaSchema.pre('save', async function (next) {
|
||||
@@ -230,7 +233,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -256,7 +259,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -296,7 +299,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
/*{
|
||||
'$lookup': {
|
||||
@@ -322,7 +325,7 @@ MyBachecaSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
'$project': shared_consts.getProjectForAll({}, tableModel),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
|
||||
@@ -2,7 +2,9 @@ const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectID, ObjectId } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const { MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa } = require('../models/myscheda');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -13,6 +15,10 @@ mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const IElementiPagina = new Schema({
|
||||
pagina: IDimensioni,
|
||||
});
|
||||
|
||||
const myCard = new Schema(
|
||||
{
|
||||
imagefile: String,
|
||||
@@ -46,15 +52,40 @@ const elemText = new Schema(
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
const catalogo = new Schema(
|
||||
{
|
||||
//++AddCATALOGO_FIELDS
|
||||
productTypes: [{ type: Number }],
|
||||
excludeproductTypes: [{ type: Number }],
|
||||
Editore: [{ type: String }],
|
||||
editore: [{ type: String }],
|
||||
argomenti: [{ type: String }],
|
||||
idCollana: { type: Number },
|
||||
sort_field: { type: String },
|
||||
sort_dir: { type: Number },
|
||||
pdf: { type: Boolean },
|
||||
// formato: [{ type: String, default: '' }],
|
||||
// categoria: [{ type: String, default: '' }],
|
||||
pdf_filename: { type: String },
|
||||
printable: { type: Boolean },
|
||||
indebug: { type: Boolean },
|
||||
|
||||
first_page: IDimensioni,
|
||||
last_page: IDimensioni,
|
||||
areadistampa: IAreaDiStampa,
|
||||
|
||||
dimensioni_def: IElementiPagina,
|
||||
|
||||
// -------------------
|
||||
arrSchede: [
|
||||
{
|
||||
scheda: MySchedaSchema,
|
||||
order: { type: Number },
|
||||
numPagineMax: { type: Number },
|
||||
/*arrProdToShow: {
|
||||
type: [[mongoose.Schema.Types.Mixed]], // Definizione tipo
|
||||
select: false // Imposta il campo come non selezionabile
|
||||
},*/
|
||||
}
|
||||
],
|
||||
}
|
||||
);
|
||||
|
||||
@@ -65,6 +96,10 @@ const MyElemSchema = new Schema({
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
oldpath: {
|
||||
type: String,
|
||||
},
|
||||
idPage: { type: String },
|
||||
type: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -105,7 +140,10 @@ const MyElemSchema = new Schema({
|
||||
type: Boolean,
|
||||
},
|
||||
number: {
|
||||
type: String,
|
||||
type: Number,
|
||||
},
|
||||
num2: {
|
||||
type: Number,
|
||||
},
|
||||
imgback: {
|
||||
type: String,
|
||||
@@ -129,6 +167,9 @@ const MyElemSchema = new Schema({
|
||||
heightimg: {
|
||||
type: String,
|
||||
},
|
||||
heightcarousel: {
|
||||
type: String,
|
||||
},
|
||||
widthimg: {
|
||||
type: String,
|
||||
},
|
||||
@@ -197,11 +238,18 @@ const MyElemSchema = new Schema({
|
||||
}
|
||||
}
|
||||
],
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
});
|
||||
|
||||
MyElemSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID();
|
||||
this._id = new ObjectId();
|
||||
}
|
||||
|
||||
next();
|
||||
@@ -217,12 +265,172 @@ MyElemSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
MyElemSchema.statics.SetIdPageInsteadThePah = async function (idapp) {
|
||||
const MyElem = this;
|
||||
|
||||
const { MyPage } = require('../models/mypage');
|
||||
|
||||
// Sostituisci path con IdPage
|
||||
try {
|
||||
// Recupera tutti i documenti di MyPage
|
||||
const pages = await MyPage.find({ idapp }); // Puoi anche specificare condizioni, se necessario
|
||||
|
||||
// Utilizza una mappa per accoppiare i path con i loro Id
|
||||
const pathToIdMap = {};
|
||||
pages.forEach(page => {
|
||||
pathToIdMap[page.path] = page._id; // Mappa il path all'ID del documento MyPage
|
||||
});
|
||||
|
||||
// Aggiorna MyElem utilizzando la mappa
|
||||
for (const [path, id] of Object.entries(pathToIdMap)) {
|
||||
if (path) {
|
||||
await MyElem.updateMany(
|
||||
{ idapp },
|
||||
{ path: path }, // Condizione per aggiornare dove il path corrisponde
|
||||
{
|
||||
$set: {
|
||||
idPage: id,
|
||||
oldpath: path,
|
||||
},
|
||||
$unset: { path: "" } // Rimuove il campo path
|
||||
} // Imposta IdPage all'ID del documento corrispondente
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (false) {
|
||||
// Utilizza una mappa per accoppiare i path con i loro Id
|
||||
const pathToIdMap2 = {};
|
||||
pages.forEach(page => {
|
||||
pathToIdMap2[page.path] = page._id.toString(); // Mappa il path all'ID del documento MyPage
|
||||
});
|
||||
|
||||
// Aggiorna MyElem utilizzando la mappa
|
||||
for (const [path, id] of Object.entries(pathToIdMap2)) {
|
||||
await MyElem.updateMany(
|
||||
{ oldpath: path }, // Condizione per aggiornare dove il path corrisponde
|
||||
{
|
||||
$unset: { idPage: "" } // Rimuove il campo path
|
||||
} // Imposta IdPage all'ID del documento corrispondente
|
||||
);
|
||||
}
|
||||
|
||||
for (const [oldpath, id] of Object.entries(pathToIdMap2)) {
|
||||
await MyElem.updateMany(
|
||||
{ oldpath: oldpath }, // Condizione per aggiornare dove il path corrisponde
|
||||
{
|
||||
$set: { idPage: id }
|
||||
} // Imposta IdPage all'ID del documento corrispondente
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const pathToIdMap2 = {};
|
||||
pages.forEach(page => {
|
||||
pathToIdMap2[page.path] = page._id.toString(); // Mappa il path all'ID del documento MyPage
|
||||
});
|
||||
|
||||
for (const [oldpath, id] of Object.entries(pathToIdMap2)) {
|
||||
await MyElem.updateMany(
|
||||
{ idapp },
|
||||
{ oldpath: oldpath }, // Condizione per aggiornare dove il path corrisponde
|
||||
{
|
||||
$set: { idPage: id }
|
||||
} // Imposta IdPage all'ID del documento corrispondente
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
console.log('Aggiornamenti effettuati con successo.');
|
||||
return 'Aggiornamenti effettuati con successo.';
|
||||
} catch (error) {
|
||||
console.error('Errore durante l\'aggiornamento:', error);
|
||||
return 'Errore durante l\'aggiornamento:', error;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
MyElemSchema.statics.deleteAllFromThisPage = async function (id) {
|
||||
const MyElem = this;
|
||||
|
||||
return MyElem.deleteMany({ idPage: id });
|
||||
|
||||
};
|
||||
MyElemSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const MyElem = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await MyElem.find(myfind).sort({ order: 1 });
|
||||
const arrrec = await MyElem.find(myfind).lean().sort({ order: 1 });
|
||||
|
||||
return arrrec;
|
||||
};
|
||||
|
||||
MyElemSchema.statics.findallSchedeTemplate = async function (idapp) {
|
||||
const MyElem = this;
|
||||
|
||||
try {
|
||||
|
||||
const ris = await MyElem.find({ idapp }).lean();
|
||||
|
||||
const schedeTemplate = ris.flatMap(elem =>
|
||||
elem.catalogo && elem.catalogo.arrSchede ?
|
||||
elem.catalogo.arrSchede
|
||||
.filter(scheda => scheda.scheda?.isTemplate)
|
||||
.map(scheda => ({
|
||||
...scheda, // mantieni i dati originali della scheda
|
||||
idPageOrig: elem.idPage // aggiungi l'idPage
|
||||
}))
|
||||
: []
|
||||
);
|
||||
|
||||
return schedeTemplate;
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
};
|
||||
|
||||
// Ricerca tra tutte le schede, contenute in catalogo, se esiste un nome di template uguale,
|
||||
// se non lo trova allora è quello giusto per crearne uno nuovo
|
||||
MyElemSchema.statics.getNewFreeNameTemplate = async function (idapp, idPageOrig, nomeTemplate) {
|
||||
const MyElem = this;
|
||||
|
||||
try {
|
||||
const ris = await MyElem.find(
|
||||
{
|
||||
idapp,
|
||||
'catalogo.arrSchede.scheda.isTemplate': true,
|
||||
'catalogo.arrSchede.scheda.idPage': { $ne: idPageOrig }
|
||||
},
|
||||
{
|
||||
'catalogo.arrSchede.scheda.name': 1,
|
||||
'catalogo.arrSchede.scheda.isTemplate': 1,
|
||||
'catalogo.arrSchede.scheda.idPage': 1
|
||||
});
|
||||
|
||||
const existingNames = new Set(
|
||||
ris.flatMap(elem =>
|
||||
elem.catalogo?.arrSchede?.filter(scheda =>
|
||||
scheda.scheda?.isTemplate &&
|
||||
scheda.scheda?.idPage !== idPageOrig
|
||||
)
|
||||
.map(scheda => scheda.scheda?.name) || []
|
||||
)
|
||||
);
|
||||
|
||||
let ind = 2;
|
||||
let newNameTemplate;
|
||||
|
||||
do {
|
||||
newNameTemplate = `${nomeTemplate}_copia_${ind}`;
|
||||
ind++;
|
||||
} while (existingNames.has(newNameTemplate) && ind <= 1000);
|
||||
|
||||
return newNameTemplate;
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
throw e; // Propagate the error
|
||||
}
|
||||
};
|
||||
|
||||
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
const {Settings} = require('./settings');
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ const { MyGroup } = require('./mygroup');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_MYGOODS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -28,6 +30,7 @@ const MyGoodSchema = new Schema({
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
groupname: { type: String },
|
||||
idSectorGood: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -92,7 +95,7 @@ const MyGoodSchema = new Schema({
|
||||
},
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
});
|
||||
|
||||
MyGoodSchema.pre('save', async function (next) {
|
||||
@@ -143,7 +146,7 @@ MyGoodSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -201,7 +204,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -227,7 +230,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -254,7 +257,21 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$lookup: {
|
||||
'from': 'mygroups',
|
||||
'localField': 'groupname',
|
||||
'foreignField': 'groupname',
|
||||
'as': 'mygrp',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$mygrp',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -280,7 +297,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -313,7 +330,7 @@ MyGoodSchema.statics.getMyRecById = function (idapp, idGood) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
@@ -8,7 +8,7 @@ const shared_consts = require('../tools/shared_nodejs');
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = 'F';
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -19,7 +19,7 @@ const MyGroupSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -66,7 +66,6 @@ const MyGroupSchema = new Schema({
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
//**ADDFIELD_MYGROUPS
|
||||
visibility: [
|
||||
{
|
||||
type: Number,
|
||||
@@ -125,11 +124,9 @@ const MyGroupSchema = new Schema({
|
||||
lastdate_reqRisGroup: {
|
||||
type: Date,
|
||||
},
|
||||
//**ADDFIELD_MYGROUPS
|
||||
|
||||
idMyGroup: {
|
||||
type: String,
|
||||
},
|
||||
// **ADDFIELD_MYGROUPS
|
||||
...tools.getFieldsForAnnunci(),
|
||||
|
||||
});
|
||||
|
||||
@@ -177,7 +174,7 @@ MyGroupSchema.statics.findAllGroups = async function (idapp) {
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow);
|
||||
}, whatToShow).lean();
|
||||
};
|
||||
|
||||
// Rimuovo la Richiesta del Gruppo
|
||||
@@ -252,7 +249,6 @@ MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
|
||||
photos: 1,
|
||||
idCity: 1,
|
||||
website: 1,
|
||||
//**ADDFIELD_MYGROUPS
|
||||
link_telegram: 1,
|
||||
note: 1,
|
||||
admins: 1,
|
||||
@@ -264,6 +260,7 @@ MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
|
||||
date_updated: 1,
|
||||
mycircuits: 1,
|
||||
lastdate_reqRisGroup: 1,
|
||||
//**ADDFIELD_MYGROUPS
|
||||
};
|
||||
|
||||
whatToShow = { ...whatToShow, ...shared_consts.ANNUNCI_FIELDS };
|
||||
@@ -647,7 +644,7 @@ MyGroupSchema.statics.getReceiveRISGroups = async function (idapp) {
|
||||
|
||||
|
||||
MyGroupSchema.statics.renameCircuitName = async function (idapp, oldcircuitname, newcircuitname) {
|
||||
|
||||
|
||||
return await this.updateMany({ idapp, 'mycircuits.circuitname': oldcircuitname }, { $set: { 'profile.mycircuits.$.circuitname': newcircuitname } });
|
||||
};
|
||||
|
||||
@@ -663,17 +660,6 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
|
||||
|
||||
};
|
||||
|
||||
MyGroupSchema.statics.getFieldsForAnnunci = function () {
|
||||
let annunciFields = {
|
||||
idMyGroup: {
|
||||
type: String,
|
||||
},
|
||||
// **ADDFIELD_MYGROUPS
|
||||
};
|
||||
|
||||
return annunciFields;
|
||||
};
|
||||
|
||||
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
||||
|
||||
MyGroup.createIndexes((err) => {
|
||||
|
||||
@@ -10,7 +10,9 @@ const { Reaction } = require('./reaction');
|
||||
const { MyGroup } = require('./mygroup');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_MYHOSPS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -27,6 +29,7 @@ const MyHospSchema = new Schema({
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
groupname: { type: String },
|
||||
visibile: {
|
||||
type: Boolean
|
||||
},
|
||||
@@ -99,7 +102,7 @@ const MyHospSchema = new Schema({
|
||||
},
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
});
|
||||
|
||||
MyHospSchema.pre('save', async function (next) {
|
||||
@@ -147,7 +150,7 @@ MyHospSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -202,7 +205,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -228,7 +231,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -254,7 +257,21 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$lookup: {
|
||||
'from': 'mygroups',
|
||||
'localField': 'groupname',
|
||||
'foreignField': 'groupname',
|
||||
'as': 'mygrp',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$mygrp',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
/*{
|
||||
'$lookup': {
|
||||
@@ -280,7 +297,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -313,7 +330,7 @@ MyHospSchema.statics.getMyRecById = function (idapp, id) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
@@ -137,6 +137,13 @@ const MyPageSchema = new Schema({
|
||||
sottoMenu: [{
|
||||
type: String
|
||||
}],
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
});
|
||||
|
||||
MyPageSchema.statics.getFieldsForSearch = function () {
|
||||
|
||||
164
src/server/models/myscheda.js
Executable file
@@ -0,0 +1,164 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const ISize = new Schema({
|
||||
width: { type: String },
|
||||
height: { type: String },
|
||||
fit: { type: String },
|
||||
gap: { type: String },
|
||||
});
|
||||
const IFont = new Schema({
|
||||
name: { type: String },
|
||||
size: { type: String },
|
||||
line_height: { type: Number },
|
||||
posiz_text: { type: Number },
|
||||
perc_text: { type: String },
|
||||
});
|
||||
|
||||
const IBorders = new Schema({
|
||||
top: { type: String },
|
||||
bottom: { type: String },
|
||||
left: { type: String },
|
||||
right: { type: String },
|
||||
})
|
||||
const IImg = new Schema({
|
||||
imagefile: { type: String },
|
||||
fit: { type: String },
|
||||
})
|
||||
|
||||
const IText = new Schema(
|
||||
{
|
||||
contenuto: String,
|
||||
maxlength: Number,
|
||||
font: IFont,
|
||||
size: ISize,
|
||||
}
|
||||
);
|
||||
|
||||
const IDimensioni = new Schema({
|
||||
size: ISize,
|
||||
margini: IBorders,
|
||||
padding: IBorders,
|
||||
imgsfondo: IImg,
|
||||
text_html: IText,
|
||||
});
|
||||
const IPagina = new Schema({
|
||||
dimensioni: IDimensioni,
|
||||
testo_up: IText,
|
||||
testo_down: IText,
|
||||
});
|
||||
|
||||
const IAreaDiStampa = new Schema({
|
||||
margini: IBorders,
|
||||
unit: String,
|
||||
format: [{ type: Number }],
|
||||
orientation: String,
|
||||
compress: Boolean,
|
||||
scale: Number,
|
||||
scale_printable: Number,
|
||||
scalecanvas: Number,
|
||||
});
|
||||
|
||||
const INovita = new Schema(
|
||||
{
|
||||
show: Boolean,
|
||||
months: Number,
|
||||
}
|
||||
);
|
||||
|
||||
const IBestseller = new Schema(
|
||||
{
|
||||
show: Boolean,
|
||||
primiNInClassifica: Number,
|
||||
}
|
||||
);
|
||||
|
||||
const IEtichette = new Schema(
|
||||
{
|
||||
novita: INovita,
|
||||
bestseller: IBestseller,
|
||||
}
|
||||
);
|
||||
|
||||
const IBarCode = new Schema(
|
||||
{
|
||||
show: Boolean,
|
||||
format: Number,
|
||||
size: ISize,
|
||||
font: IFont,
|
||||
widthlines: Number,
|
||||
show_at_right: Boolean,
|
||||
}
|
||||
);
|
||||
|
||||
const IElementiScheda = new Schema({
|
||||
pagina: IPagina,
|
||||
riga: IDimensioni,
|
||||
scheda_prodotto: IDimensioni,
|
||||
immagine_prodotto: IDimensioni,
|
||||
});
|
||||
|
||||
const scheletroScheda = {
|
||||
idapp: { type: String },
|
||||
isTemplate: { type: Boolean },
|
||||
linkIdTemplate: { type: String },
|
||||
name: { type: String },
|
||||
numschede_perRiga: { type: Number },
|
||||
numschede_perCol: { type: Number },
|
||||
show_separatore: { type: Boolean },
|
||||
testo_right_attaccato: IText,
|
||||
testo_right: IText,
|
||||
testo_bottom: IText,
|
||||
barcode: IBarCode,
|
||||
etichette: IEtichette,
|
||||
|
||||
dimensioni: IElementiScheda,
|
||||
|
||||
productTypes: [{ type: Number }],
|
||||
excludeproductTypes: [{ type: Number }],
|
||||
editore: [{ type: String }],
|
||||
argomenti: [{ type: String }],
|
||||
idCollana: { type: Number },
|
||||
author: { type: String },
|
||||
sort_field: { type: String },
|
||||
sort_dir: { type: Number },
|
||||
arrProdottiSpeciali: [{ type: String }],
|
||||
};
|
||||
|
||||
const MySchedaSchema = new Schema(
|
||||
scheletroScheda
|
||||
);
|
||||
|
||||
|
||||
MySchedaSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'name', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
MySchedaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
MySchedaSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
};
|
||||
|
||||
const MyScheda = mongoose.model('MyScheda', MySchedaSchema);
|
||||
|
||||
MyScheda.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa };
|
||||
@@ -11,7 +11,9 @@ const { MyGroup } = require('./mygroup');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_MYSKILLS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -24,7 +26,7 @@ const MySkillSchema = new Schema(
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -32,6 +34,7 @@ const MySkillSchema = new Schema(
|
||||
required: true,
|
||||
},
|
||||
userId: { type: Schema.Types.ObjectId, ref: 'User' },
|
||||
groupname: { type: String },
|
||||
idSector: {
|
||||
type: Number,
|
||||
},
|
||||
@@ -99,7 +102,7 @@ const MySkillSchema = new Schema(
|
||||
},
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
}, { strict: false });
|
||||
|
||||
MySkillSchema.index({ 'idapp': 1 });
|
||||
@@ -152,7 +155,7 @@ MySkillSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -206,7 +209,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -232,7 +235,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -258,7 +261,21 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$lookup: {
|
||||
'from': 'mygroups',
|
||||
'localField': 'groupname',
|
||||
'foreignField': 'groupname',
|
||||
'as': 'mygrp',
|
||||
},
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$mygrp',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
/*{
|
||||
'$lookup': {
|
||||
@@ -286,7 +303,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -319,7 +336,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -377,7 +377,7 @@ module.exports.updateTotals = function (order) {
|
||||
|
||||
module.exports.getTotalOrderById = async function (id) {
|
||||
const query = [
|
||||
{ $match: { _id: ObjectID(id) } },
|
||||
{ $match: { _id: ObjectId(id) } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
@@ -660,7 +660,7 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
|
||||
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
|
||||
|
||||
const myquery = [
|
||||
{ $match: { idGasordine: ObjectID(myidGasordine) } },
|
||||
{ $match: { idGasordine: ObjectId(myidGasordine) } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
|
||||
@@ -20,7 +20,7 @@ const Cart = require('../models/cart');
|
||||
const tools = require('../tools/general');
|
||||
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const OrdersCartSchema = new Schema({
|
||||
idapp: {
|
||||
@@ -198,7 +198,7 @@ module.exports.getRecCartByUserId = async function (uid, idapp, numorder) {
|
||||
|
||||
module.exports.getOrdersCartById = async function (id) {
|
||||
|
||||
let query = { _id: ObjectID(id) };
|
||||
let query = { _id: ObjectId(id) };
|
||||
|
||||
const arrris = await OrdersCart.getOrdersCartByQuery(query);
|
||||
let myrec = arrris && arrris.length > 0 ? arrris[0] : null;
|
||||
|
||||
@@ -13,7 +13,7 @@ const Scontistica = require('../models/scontistica');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -76,9 +76,12 @@ const productSchema = new Schema({
|
||||
quantita: { // in magazzino
|
||||
type: Number,
|
||||
},
|
||||
numpages: {
|
||||
pagine: {
|
||||
type: Number,
|
||||
},
|
||||
misure: {
|
||||
type: String,
|
||||
},
|
||||
formato: {
|
||||
type: String,
|
||||
},
|
||||
@@ -209,6 +212,15 @@ const productSchema = new Schema({
|
||||
gas_name: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var Product = module.exports = mongoose.model('Product', productSchema);
|
||||
@@ -989,7 +1001,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
|
||||
}
|
||||
|
||||
if (!tools.isObjectEmpty(objtoset)) {
|
||||
ris = await Product.findOneAndUpdate({ _id: ObjectID(prod._id) }, { $set: objtoset })
|
||||
ris = await Product.findOneAndUpdate({ _id: ObjectId(prod._id) }, { $set: objtoset })
|
||||
|
||||
const objDelete = {
|
||||
cat_name: 1,
|
||||
@@ -1002,7 +1014,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
|
||||
gas_name: 1,
|
||||
};
|
||||
|
||||
ris = await Product.updateOne({ _id: ObjectID(prod._id) }, { $unset: objDelete })
|
||||
ris = await Product.updateOne({ _id: ObjectId(prod._id) }, { $unset: objDelete })
|
||||
|
||||
if (ris && ris.nModified > 0) {
|
||||
console.log('Modificato: ', objtoset.name);
|
||||
|
||||
@@ -19,6 +19,9 @@ const productInfoSchema = new Schema({
|
||||
department: {
|
||||
type: String, ref: 'Department'
|
||||
},
|
||||
sku: {
|
||||
type: String,
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
unique: true,
|
||||
@@ -73,9 +76,15 @@ const productInfoSchema = new Schema({
|
||||
icon: {
|
||||
type: String,
|
||||
},
|
||||
img: { // Se esiste img (sul server) visualizza questa, altrimenti vedi se esiste image_link
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
imagefile: {
|
||||
type: String,
|
||||
},
|
||||
vers_img: {
|
||||
type: Number,
|
||||
},
|
||||
image_link: {
|
||||
type: String,
|
||||
},
|
||||
@@ -110,26 +119,53 @@ const productInfoSchema = new Schema({
|
||||
type: String,
|
||||
},
|
||||
idAuthors: [{ type: Schema.Types.ObjectId, ref: 'Author' }],
|
||||
idCollana: { type: Schema.Types.ObjectId, ref: 'Collana' },
|
||||
idPublisher: { type: Schema.Types.ObjectId, ref: 'Publisher' },
|
||||
collezione: {
|
||||
type: String,
|
||||
},
|
||||
date_publishing: {
|
||||
date_pub: {
|
||||
type: Date,
|
||||
},
|
||||
date_publishing_ts: {
|
||||
date_pub_ts: {
|
||||
type: Number,
|
||||
},
|
||||
productTypes: [{
|
||||
type: Number,
|
||||
}],
|
||||
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
|
||||
totVen: Number,
|
||||
totFat: Number,
|
||||
vLast3M: Number,
|
||||
fatLast3M: Number,
|
||||
vLast6M: Number,
|
||||
vLastY: Number,
|
||||
vLast2Y: Number,
|
||||
dataUltimoOrdine: Date,
|
||||
rank3M: Number,
|
||||
rank6M: Number,
|
||||
rank1Y: Number,
|
||||
|
||||
descrizione_breve_macro: String,
|
||||
descrizione_completa_macro: String,
|
||||
sottotitolo: String,
|
||||
link_macro: String,
|
||||
|
||||
});
|
||||
|
||||
var productInfo = module.exports = mongoose.model('ProductInfo', productInfoSchema);
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [{ field: 'name', type: tools.FieldType.string }]
|
||||
return [
|
||||
{ field: 'name', type: tools.FieldType.string },
|
||||
{ field: 'code', type: tools.FieldType.string },
|
||||
{ field: 'sku', type: tools.FieldType.string },
|
||||
{ field: 'codice_EAN', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
@@ -185,6 +221,14 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
as: 'authors'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'collanas',
|
||||
localField: 'idCollana',
|
||||
foreignField: '_id',
|
||||
as: 'collana'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'publishers',
|
||||
@@ -221,7 +265,52 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
module.exports.getProductByCode = function (idapp, code) {
|
||||
return productInfo.findAllIdApp(idapp, code);
|
||||
}
|
||||
module.exports.correggiProductTypes = async function() {
|
||||
module.exports.replaceProductImgToImageFile = async function (abilitaserver) {
|
||||
const ProductInfo = this;
|
||||
|
||||
if (abilitaserver) {
|
||||
// const result = await ProductInfo.updateMany({ "img": { $exists: true } }, { $rename: { 'img': 'imagefile' } });
|
||||
|
||||
// Trova tutti i documenti con il campo 'img' che esiste
|
||||
const documents = await ProductInfo.find({ "img": { $exists: true } });
|
||||
|
||||
// Aggiorna ciascun documento
|
||||
for (let doc of documents) {
|
||||
if (doc.img && doc.img.startsWith('upload/products/')) {
|
||||
// Rimuovi il prefisso '/upload/products' dal campo `img`
|
||||
doc.imagefile = doc.img.replace(/^\upload\/products\//, '');
|
||||
doc.img = undefined; // Può anche rimuovere il campo img corrente se desiderato
|
||||
await doc.save(); // Salva il documento aggiornato
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Updated ${documents.length} document(s) with new imagefile paths.`);
|
||||
|
||||
} else {
|
||||
const documents = await ProductInfo.find({ "imagefile": { $exists: true } });
|
||||
|
||||
// Aggiorna ciascun documento
|
||||
for (let doc of documents) {
|
||||
if (doc.imagefile && doc.imagefile.startsWith('upload/products/')) {
|
||||
// Rimuovi il prefisso '/upload/products' dal campo `img`
|
||||
doc.imagefile = doc.imagefile.replace(/^\upload\/products\//, '');
|
||||
await doc.save(); // Salva il documento aggiornato
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Updated ${documents.length} document(s) with new imagefile paths.`);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
await ProductInfo.updateMany({}, { 'vers_img': 0 });
|
||||
|
||||
console.log(`Updated ${result.modifiedCount} document(s).`);
|
||||
|
||||
};
|
||||
|
||||
module.exports.correggiProductTypes = async function () {
|
||||
const ProductInfo = this;
|
||||
const bulkOps = [];
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ var server_constants = require('../tools/server_constants');
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -8,7 +8,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const tools = require('../tools/general');
|
||||
|
||||
// const CatAI = require('./catai');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -10,7 +10,7 @@ const shared_consts = require('../tools/shared_nodejs');
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -6,9 +6,10 @@ mongoose.level = 'F';
|
||||
|
||||
const i18n = require('i18n');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const server_constants = require('../tools/server_constants');
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
@@ -109,7 +110,10 @@ const sendNotifSchema = new Schema({
|
||||
},
|
||||
linkaddTelegram: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
sendNotifSchema.index({ idapp: 1 });
|
||||
@@ -212,39 +216,42 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
const { User } = require('../models/user');
|
||||
|
||||
try {
|
||||
let dovestr = '';
|
||||
if (recnotif.myrectableorig) {
|
||||
myidrec = recnotif.myrectableorig._id;
|
||||
mydescr = recnotif.myrectableorig.descr ? tools.firstchars(recnotif.myrectableorig.descr, numchars) : '';
|
||||
dovestr = tools.getDoveStrByAnnuncio(recnotif.myrectableorig);
|
||||
}
|
||||
|
||||
if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_BACHECA) {
|
||||
let tablerec = '';
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_GOOD) {
|
||||
newdescr = i18n.__('NEW_GOOD', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_GOOD', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYGOODS, true) + myidrec;
|
||||
tag = 'newgood';
|
||||
tablerec = 'mygoods';
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_SERVICE) {
|
||||
newdescr = i18n.__('NEW_SERVICE', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_SERVICE', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYSKILLS, true) + myidrec;
|
||||
tag = 'newservice';
|
||||
tablerec = 'myskills';
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_BACHECA_NEW_HOSP) {
|
||||
newdescr = i18n.__('NEW_HOSP', userorig, mydescr);
|
||||
newdescr = i18n.__('NEW_HOSP', userorig, mydescr, dovestr);
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYHOSPS, true) + myidrec;
|
||||
tag = 'newhosp';
|
||||
tablerec = 'myhosps';
|
||||
}
|
||||
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, tablerec, mydescr, userorig, true);
|
||||
newdescr = eventobj.newdescr;
|
||||
// newdescr = eventobj.descrperNotif;
|
||||
recnotif.textcontent_Telegram = eventobj.newdescrtelegram;
|
||||
recnotif.linkaddTelegram = '';
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_EVENTS) {
|
||||
recnotif.openUrl = shared_consts.getDirectoryByTable(shared_consts.TABLES_MYBACHECAS, true) + myidrec;
|
||||
tag = 'newevent';
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_NEW_REC) {
|
||||
let eventobj = await tools.getEventForTelegram(recnotif.myrectableorig, mydescr, userorig);
|
||||
newdescr = eventobj.newdescr;
|
||||
// let eventobj = await tools.getEventForTelegram(recnotif.myrectableorig, mydescr, userorig);
|
||||
let eventobj = await tools.getAnnuncioForTelegram(recnotif.myrectableorig, shared_consts.TABLES_MYBACHECAS, mydescr, userorig, true);
|
||||
newdescr = eventobj.descrperNotif;
|
||||
newdescrtelegram = eventobj.newdescrtelegram;
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_EVENTS_SEND_MSG) {
|
||||
newdescr = i18n.__('EVENT_SEND_MSG', userorig, recnotif.title, recnotif.msg);
|
||||
@@ -262,7 +269,7 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
|
||||
}
|
||||
recnotif.textcontent_Telegram = newdescrtelegram;
|
||||
recnotif.linkaddTelegram = i18n.__('SHOW_POST');
|
||||
// recnotif.linkaddTelegram = i18n.__('SHOW_POST');
|
||||
|
||||
} else if (recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS) {
|
||||
recnotif.openUrl = '/my/' + sender;
|
||||
@@ -397,6 +404,8 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
destinatario += ' (' + username_mittente + ')'
|
||||
}
|
||||
|
||||
const circuit = await Circuit.findOne({ name: circuitname });
|
||||
|
||||
if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_NEW_REC) {
|
||||
newdescr = i18n.__('CIRCUIT_CREATED', sender, recnotif.paramsObj.circuitnameDest);
|
||||
} else if (recnotif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SETFIDO) {
|
||||
@@ -465,7 +474,12 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
} else {
|
||||
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER', sender, '<strong>' + recnotif.paramsObj.circuitnameDest + '</strong>', numuserincircuit, aportador_solidario);
|
||||
|
||||
if (circuit.askManagerToEnter)
|
||||
newdescr = i18n.__('CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER', sender, '<strong>' + recnotif.paramsObj.circuitnameDest + '</strong>', numuserincircuit, aportador_solidario);
|
||||
|
||||
}
|
||||
|
||||
|
||||
const myadmins = await Circuit.getListAdmins(recnotif.idapp, recnotif.paramsObj.circuitnameDest);
|
||||
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_ADMINS', myadmins.num, myadmins.str);
|
||||
recnotif.textaddTelegram += '\n' + i18n.__('CIRCUIT_WHERE_IS_PRESENT', await Circuit.getListCircuitsByUsername(recnotif.idapp, sender, recnotif.extrarec.groupname));
|
||||
@@ -585,10 +599,11 @@ sendNotifSchema.statics.getDescrAndLinkByRecNotif = async function (recnotif, us
|
||||
|
||||
recnotif.tag = recnotif.tag ? recnotif.tag : tag;
|
||||
|
||||
if (!recnotif.descr) {
|
||||
if (!recnotif.descr) {
|
||||
recnotif.descr = newdescr;
|
||||
}
|
||||
|
||||
|
||||
return recnotif;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -683,7 +698,7 @@ sendNotifSchema.statics.findAllNotifCoinsAllIdAndIdApp = function (idapp) {
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
'extrarec.circuitname': { $ne: "Circuito di TEST" },
|
||||
'extrarec.symbol': { $ne: "RISTeST"},
|
||||
'extrarec.symbol': { $ne: "RISTeST" },
|
||||
}
|
||||
|
||||
return SendNotif.aggregate([
|
||||
@@ -730,7 +745,7 @@ sendNotifSchema.statics.saveAndSendNotif = async function (myrecnotif, req, res,
|
||||
// console.log('myrecread._id', myrecread._id.toString());
|
||||
|
||||
if (myrecread)
|
||||
risnotif = await globalTables.sendNotif(myrecread.typedir, myrecread.typeid, res, idapp, user ? user : req.user, myrecread);
|
||||
risnotif = await globalTables.sendNotifCmd(myrecread.typedir, myrecread.typeid, res, idapp, user ? user : req.user, myrecread);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -741,7 +756,7 @@ sendNotifSchema.statics.saveAndSendNotif = async function (myrecnotif, req, res,
|
||||
}
|
||||
|
||||
} else {
|
||||
risnotif = await globalTables.sendNotif(myrecout.typedir, myrecout.typeid, res, idapp, user ? user : req.user, myrecout);
|
||||
risnotif = await globalTables.sendNotifCmd(myrecout.typedir, myrecout.typeid, res, idapp, user ? user : req.user, myrecout);
|
||||
}
|
||||
|
||||
|
||||
@@ -889,7 +904,7 @@ sendNotifSchema.statics.updateStatusAndDescr = async function (myrecnotif, onlys
|
||||
|
||||
}
|
||||
|
||||
// myrecnotif._id = new ObjectID();
|
||||
// myrecnotif._id = new ObjectId();
|
||||
if (newstatus > 0) {
|
||||
myrecnotif.status = newstatus;
|
||||
}
|
||||
@@ -1003,6 +1018,14 @@ sendNotifSchema.statics.createNewNotification = async function (req, res, params
|
||||
myrecnotif.tablerec = table;
|
||||
if (rec && table) {
|
||||
myrecnotif.idrec = rec._id;
|
||||
try {
|
||||
if (rec.photos && rec.photos[0]) {
|
||||
const mydir = tools.getHostByIdApp(myrecnotif.idapp) + server_constants.DIR_UPLOAD + '/' + shared_consts.getDirectoryImgByTable(table, rec.username);
|
||||
myrecnotif.img = mydir + rec.photos[0].imagefile;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('createNewNotification', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1279,14 +1302,21 @@ sendNotifSchema.statics.getSumPendingTransactionsDest = async function (idapp, u
|
||||
sendNotifSchema.statics.RemovePendentTransactions = async function (idapp) {
|
||||
const SendNodif = this;
|
||||
|
||||
return await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
}
|
||||
);
|
||||
try {
|
||||
const result = await SendNodif.deleteMany(
|
||||
{
|
||||
idapp,
|
||||
typedir: shared_consts.TypeNotifs.TYPEDIR_CIRCUITS,
|
||||
typeid: shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ,
|
||||
status: 0,
|
||||
}
|
||||
);
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error deleting documents:', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -129,7 +129,7 @@ SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
||||
let myrec = await Settings.findOne({ idapp, key });
|
||||
if (!myrec) {
|
||||
myrec = new Settings({ key });
|
||||
myrec._id = new ObjectID();
|
||||
myrec._id = new ObjectId();
|
||||
myrec.idapp = idapp;
|
||||
myrec.type = tools.FieldType.number;
|
||||
myrec.value_num = value;
|
||||
@@ -149,7 +149,7 @@ SettingsSchema.statics.setBool = async function (idapp, key, valbool) {
|
||||
let myrec = await Settings.findOne({ idapp, key });
|
||||
if (!myrec) {
|
||||
myrec = new Settings({ key });
|
||||
myrec._id = new ObjectID();
|
||||
myrec._id = new ObjectId();
|
||||
myrec.idapp = idapp;
|
||||
myrec.type = tools.FieldType.boolean;
|
||||
myrec.value_bool = valbool;
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
mongoose.set('debug', false);
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const _ = require('lodash');
|
||||
|
||||
@@ -409,10 +409,10 @@ module.exports.createFirstUserAdmin = async function () {
|
||||
if (numusers === 0) {
|
||||
// Non esistono utenti, quindi creo quello di Admin
|
||||
|
||||
const utenteadmin = { idapp: '13', username: telegrambot.ADMIN_USER_SERVER };
|
||||
const utenteadmin = { idapp: '13', username: shared_consts.ADMIN_USER_SERVER };
|
||||
|
||||
const newuser = new User(utenteadmin);
|
||||
newuser._id = new ObjectID();
|
||||
newuser._id = new ObjectId();
|
||||
newuser.idapp = mysite.idapp;
|
||||
newuser.profile.mygroups = [];
|
||||
newuser.profile.mycircuits = [];
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||
@@ -13,7 +13,8 @@ const { MyGroup } = require('../models/mygroup');
|
||||
const { Settings } = require('../models/settings');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -64,16 +65,9 @@ const StatSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
StatSchema.statics.updateStats = async function (datastat) {
|
||||
|
||||
datastat.last_transactions.forEach(function (mov) {
|
||||
let ris = tools.getStringaConto(mov)
|
||||
mov.myfrom = ris.myfrom
|
||||
mov.myto = ris.myto
|
||||
mov.tipocontofrom = ris.tipocontofrom
|
||||
mov.tipocontoto = ris.tipocontoto
|
||||
});
|
||||
StatSchema.statics.updateStats = async function (idapp, datastat) {
|
||||
|
||||
datastat.last_transactions = await Movement.getLastN_Transactions(idapp, 5);
|
||||
|
||||
return datastat;
|
||||
};
|
||||
@@ -103,21 +97,21 @@ StatSchema.statics.calculateStats = async function (idapp) {
|
||||
diffusorilist: await User.getDiffusoriUsers(idapp),
|
||||
receiveRislist: await User.getReceiveRISUsers(idapp),
|
||||
receiveRislistgroup: await MyGroup.getReceiveRISGroups(idapp),
|
||||
strettelist: await User.getBestStretteDiManoUsers(idapp),
|
||||
strettelist: await User.getLastStretteDiManoUsers(idapp),
|
||||
num_transaz_tot: await Movement.getTotal_Transactions(idapp),
|
||||
tot_RIS_transati: await Movement.getTot_RIS_Transati(idapp),
|
||||
num_circuiti: await Circuit.getnumCircuits(idapp),
|
||||
num_circuiti_attivi: await Circuit.getnumActiveCircuits(idapp),
|
||||
num_annunci: await User.getnumAnnunci(idapp),
|
||||
last_transactions: await Movement.getLastN_Transactions(idapp, 10),
|
||||
};
|
||||
|
||||
// Trova il record di oggi:
|
||||
const trova_se_oggi = await Stat.findOne({ idapp, date_created: { $gte: new Date(new Date().setHours(0, 0, 0, 0)) } });
|
||||
const trova_se_oggi = await Stat.findOne({ idapp, date_created: { $gte: new Date(new Date().setHours(0, 0, 0, 0)) } }).lean();
|
||||
|
||||
if (trova_se_oggi) {
|
||||
// Aggiorna il record di oggi:
|
||||
await Stat.updateOne({ _id: trova_se_oggi._id }, { $set: datastat });
|
||||
const ris = await Stat.findOneAndUpdate({ _id: trova_se_oggi._id }, { $set: datastat }, { new: true });
|
||||
// console.log('ris', ris);
|
||||
} else {
|
||||
// Aggiungi un nuovo record:
|
||||
await Stat.insertMany([datastat]);
|
||||
@@ -158,6 +152,10 @@ StatSchema.statics.getStats = async function (idapp) {
|
||||
|
||||
let datastat = null;
|
||||
|
||||
if (tools.testing()) {
|
||||
isOld = true;
|
||||
}
|
||||
|
||||
if (isOld) {
|
||||
datastat = await Stat.calculateStats(idapp);
|
||||
|
||||
@@ -165,7 +163,7 @@ StatSchema.statics.getStats = async function (idapp) {
|
||||
datastat = rec;
|
||||
}
|
||||
|
||||
datastat = await Stat.updateStats(datastat);
|
||||
datastat = await Stat.updateStats(idapp, datastat);
|
||||
|
||||
return datastat;
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ const SubCatProdSchema = new Schema({
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
descr_estesa: {
|
||||
type: String,
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
|
||||