Merge branch 'Dev_PDB1' into develop

This commit is contained in:
Surya Paolo
2024-05-29 11:14:25 +02:00
156 changed files with 3609637 additions and 5761 deletions

BIN
.DS_Store vendored

Binary file not shown.

41
.env.dev.pcb Normal file
View File

@@ -0,0 +1,41 @@
DATABASE=test_PiuCheBuono
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
appTelegram_TEST=["1","17","18"]
appTelegram=["1","17","18"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
ENABLE_PUSHNOTIFICATION=1
URLBASE_APP1=https://localhost
PORT_APP1=8080
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
HTTPS_LOCALHOST=true
DEBUG=0
DEBUG=0
TESTING_ON=1
LOCALE=1
DELAY_SENDEMAIL=2000
VAPI_KEY_SUBJECT=mailto:paolo@freeplanet.app
PUBLIC_VAPI_KEY=BDncvMiUZmjaCG2Kr1V9N0_33hOG-AuNSbHSvL24y2dzBiUjAxKm02emx5SeJvz2IGmtRf6YqCgopeQwCwUmZw8
PRIVATE_VAPI_KEY=uB2-jQkrbysyDtqN3ziMBDsVn0wdEaDsksX81zoOGQo
PATH_CERT_KEY=localhost.key
PATH_SERVER_CRT=localhost.crt
PATH_SSL_ROOT_PEM=root.pem
PATH_SSL_CHAIN_PEM=chain.pem
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
FTPSERVER_PORT=21
FTPSERVER_USER=ftpusrsrv_
FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123

41
.env.dev.riso Normal file
View File

@@ -0,0 +1,41 @@
DATABASE=test_FreePlanet
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
appTelegram_TEST=["1","13"]
appTelegram=["1","13"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
ENABLE_PUSHNOTIFICATION=1
URLBASE_APP1=https://localhost
PORT_APP1=8080
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
HTTPS_LOCALHOST=true
DEBUG=0
DEBUG=0
TESTING_ON=1
LOCALE=1
DELAY_SENDEMAIL=2000
VAPI_KEY_SUBJECT=mailto:paolo@freeplanet.app
PUBLIC_VAPI_KEY=BDncvMiUZmjaCG2Kr1V9N0_33hOG-AuNSbHSvL24y2dzBiUjAxKm02emx5SeJvz2IGmtRf6YqCgopeQwCwUmZw8
PRIVATE_VAPI_KEY=uB2-jQkrbysyDtqN3ziMBDsVn0wdEaDsksX81zoOGQo
PATH_CERT_KEY=localhost.key
PATH_SERVER_CRT=localhost.crt
PATH_SSL_ROOT_PEM=root.pem
PATH_SSL_CHAIN_PEM=chain.pem
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
FTPSERVER_PORT=21
FTPSERVER_USER=ftpusrsrv_
FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123

41
.env.development Normal file
View File

@@ -0,0 +1,41 @@
DATABASE=test_FreePlanet
UDB=paofreeplanet
PDB=mypassword@1A
SEND_EMAIL=0
SEND_EMAIL_ORDERS=1
PORT=3000
appTelegram_TEST=["1","13"]
appTelegram=["1","13"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
ENABLE_PUSHNOTIFICATION=1
URLBASE_APP1=https://localhost
PORT_APP1=8080
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
HTTPS_LOCALHOST=true
DEBUG=0
DEBUG=0
TESTING_ON=1
LOCALE=1
DELAY_SENDEMAIL=2000
VAPI_KEY_SUBJECT=mailto:paolo@freeplanet.app
PUBLIC_VAPI_KEY=BDncvMiUZmjaCG2Kr1V9N0_33hOG-AuNSbHSvL24y2dzBiUjAxKm02emx5SeJvz2IGmtRf6YqCgopeQwCwUmZw8
PRIVATE_VAPI_KEY=uB2-jQkrbysyDtqN3ziMBDsVn0wdEaDsksX81zoOGQo
PATH_CERT_KEY=localhost.key
PATH_SERVER_CRT=localhost.crt
PATH_SSL_ROOT_PEM=root.pem
PATH_SSL_CHAIN_PEM=chain.pem
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
FTPSERVER_PORT=21
FTPSERVER_USER=ftpusrsrv_
FTPSERVER_PWD=ftpmypwd@1A_
AUTH_NEW_SITES=123123123

35
.env.prod.pcb Normal file
View File

@@ -0,0 +1,35 @@
DATABASE=PiuCheBuono
UDB=paofreeplanet
PDB=suerteFreePlanet@1A
SEND_EMAIL=1
SEND_EMAIL_ORDERS=1
PORT=3000
appTelegram_TEST=["17","18"]
appTelegram=["17","18"]
ENABLE_PUSHNOTIFICATION=1
DIRECTORY_SERVER=freeplanet_serverside
SERVERDIR_WEBSITE=www.freeplanet_server
PORT_APP1="0"
DOMAIN=mongodb://localhost:32001/
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="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
PRIVATE_VAPI_KEY="LVpFDJuKscdHuQr5pe20dFuYuWX1-ZRb6x72PP-Pp4I"
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=0
PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
SECRTK=jAxKm02emx5SeJvz2IGmtRf6YqCgope
TOKEN_LIFE=2h
REFRESH_TOKEN_LIFE=14d
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNVZZ

34
.env.test.pcb Normal file
View File

@@ -0,0 +1,34 @@
DATABASE=test_PiuCheBuono
UDB=paofreeplanet
PDB=suerteFreePlanet@1A
SEND_EMAIL=1
SEND_EMAIL_ORDERS=1
PORT=3001
appTelegram_TEST=["17","18"]
appTelegram=["17","18"]
ENABLE_PUSHNOTIFICATION=1
DIRECTORY_SERVER=freeplanet_serverside
SERVERDIR_WEBSITE=test.freeplanet_server
PORT_APP1="0"
DOMAIN=mongodb://localhost:32002/
AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
DEBUG=0
LOCALE=0
DELAY_SENDEMAIL=1000
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
PUBLIC_VAPI_KEY="BJgo8XR_upbnbMLWgCAUELo6DK7dRXffYAnFOxbaMMz5favBgcQBKT-eISqouO-jRad4Sw8l5nd2wCF6KorGiTc"
PRIVATE_VAPI_KEY="LVpFDJuKscdHuQr5pe20dFuYuWX1-ZRb6x72PP-Pp4I"
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=0
PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
TOKEN_LIFE=2h
REFRESH_TOKEN_LIFE=14d
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV

View File

@@ -4,11 +4,14 @@ PDB=suerteFreePlanet@1A
SEND_EMAIL=1 SEND_EMAIL=1
PORT=3001 PORT=3001
ENABLE_PUSHNOTIFICATION=1 ENABLE_PUSHNOTIFICATION=1
DIRECTORY_SERVER=freeplanet_serverside DIRECTORY_SERVER=/var/www/testriso.freeplanet_serverside
SERVERDIR_WEBSITE=test.freeplanet_server SERVERDIR_WEBSITE=testriso.piuchebuono.app
PORT_APP1="0" PORT_APP1="0"
DOMAIN=mongodb://localhost:27018/ DOMAIN=mongodb://localhost:32002/
SIGNCODE=abc123 AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
DEBUG=0 DEBUG=0
LOCALE=0 LOCALE=0
DELAY_SENDEMAIL=1000 DELAY_SENDEMAIL=1000
@@ -23,3 +26,6 @@ PATH_SSL_CHAIN_PEM=chain.pem
PROD=0 PROD=0
PROJECT_DESCR_MAIN='__PROJECTS' PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
TOKEN_LIFE=2h
REFRESH_TOKEN_LIFE=14d
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV

32
.env.test2 Normal file
View File

@@ -0,0 +1,32 @@
DATABASE=test_FreePlanet
UDB=paofreeplanet
PDB=suerteFreePlanet@1A
SEND_EMAIL=1
PORT=3001
ENABLE_PUSHNOTIFICATION=1
DIRECTORY_SERVER=freeplanet_serverside
SERVERDIR_WEBSITE=test2.freeplanet_server
URLBASE_APP1=https://test2.riso.app
PORT_APP1="0"
DOMAIN=mongodb://localhost:27018/
AUTH_MONGODB=1
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@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=0
PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
TOKEN_LIFE=2h
REFRESH_TOKEN_LIFE=14d
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV

5
.gitignore vendored
View File

@@ -1,6 +1,5 @@
node_modules/ node_modules/
.env.test .env.test
.env.development
.env.production .env.production
.env.production.bak .env.production.bak
ESEMPI/ ESEMPI/
@@ -29,4 +28,6 @@ emails/.DS_Store
.DS_Store .DS_Store
.DS_Store .DS_Store
.DS_Store .DS_Store
.vscode/launch.json logtrans.txt
yarn.lock
logtrans.txt

39
.vscode/launch.json vendored
View File

@@ -7,19 +7,21 @@
"name": "Launch via Nodemon", "name": "Launch via Nodemon",
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js", "program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"restart": true, "restart": true,
"runtimeExecutable": "/Users/paolo/.nvm/versions/node/v16.19.0/bin/node", "runtimeExecutable": "node",
"runtimeArgs": [ "runtimeArgs": [
"--inspect=9229" // Use "--inspect=0.0.0.0:9229" for remote debugging "--inspect=9229" // Use "--inspect=0.0.0.0:9229" for remote debugging
], ],
"args": ["${workspaceFolder}/src/server/server.js"], // Replace with your entry file "args": [
"${workspaceFolder}/src/server/server.js"
], // Replace with your entry file
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"autoAttachChildProcesses": true, "autoAttachChildProcesses": true,
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"sourceMaps": true, "sourceMaps": true,
"env": { "env": {
"NODE_ENV":"development", "NODE_ENV": "development",
"TESTING_ON":"1" "TESTING_ON": "1"
}, },
}, },
{ {
@@ -32,33 +34,18 @@
"runtimeArgs": [ "runtimeArgs": [
"--trace-warnings" // Use "--inspect=0.0.0.0:9229" for remote debugging "--trace-warnings" // Use "--inspect=0.0.0.0:9229" for remote debugging
], ],
"args": ["${workspaceFolder}/src/server/server.js"], // Replace with your entry file "args": [
"${workspaceFolder}/src/server/server.js"
], // Replace with your entry file
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"autoAttachChildProcesses": true, "autoAttachChildProcesses": true,
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"sourceMaps": true, "sourceMaps": true,
"env": { "env": {
"NODE_ENV":"development", "NODE_ENV": "development",
"TESTING_ON":"1" "TESTING_ON": "1"
}, },
},
{
"name": "Server Debug",
"request": "launch",
"runtimeArgs": [
"run-script",
"start"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"env": {
"NODE_ENV":"development",
"TESTING_ON":"1"
},
"type": "node"
}, },
{ {
"name": "ServerSide", "name": "ServerSide",
@@ -69,8 +56,8 @@
], ],
"type": "node", "type": "node",
"env": { "env": {
"NODE_ENV":"development", "NODE_ENV": "development",
"TESTING_ON":"1" "TESTING_ON": "1"
} }
}, },
] ]

View File

@@ -1,3 +1,8 @@
{ {
"search.useIgnoreFiles": false "search.useIgnoreFiles": false,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/node_modules/**": true,
"**/src/server/router/upload/**": true
},
} }

4
check_permessi_server_test2.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
ssh -p 8855 suryapaolo@servereng "ls -ld /var/www/test2.freeplanet_server"

3592316
comuni_italia.geojson Normal file

File diff suppressed because it is too large Load Diff

18
deploynode_on_prod_pcb.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
source ./.env.prod.pcb
echo "Sincronizzazione in corso PCB PRODUZIONE ... /var/www/$SERVERDIR_WEBSITE/"
echo ""
rsync -avz -e 'ssh -p 8822' css pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' docs pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' emails pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' images pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' plugins pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' sass pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' .env.prod.pcb pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/.env.production
rsync -avz -e 'ssh -p 8822' package.json pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/package.json
echo "Sincronizzazione TERMINATA! - SERVER PCB!"

19
deploynode_on_test_pcb.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
source ./.env.test.pcb
echo "Sincronizzazione in corso PCB TEST ... /var/www/$SERVERDIR_WEBSITE/"
echo ""
rsync -avz -e 'ssh -p 8822' css pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' docs pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' emails pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' images pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' plugins pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' sass pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/.env.test
rsync -avz -e 'ssh -p 8822' .env.test.pcb pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
rsync -avz -e 'ssh -p 8822' package.json pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/package.json
echo "Sincronizzazione TERMINATA! - SERVER PCB!"

View File

@@ -2,15 +2,20 @@
source ./.env.test.risosrv source ./.env.test.risosrv
echo "Sincronizzazione in corso..." echo "Sincronizzazione in corso... $DIRECTORY_SERVER"
rsync -avz -e 'ssh -p 5522' css root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'scp -p 8822' .env.test.risosrv pcbuser@pcb:$DIRECTORY_SERVER/.env.test
rsync -avz -e 'ssh -p 5522' docs root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' ecosystem.config.testriso.js pcbuser@pcb:$DIRECTORY_SERVER/ecosystem.config.js
rsync -avz -e 'ssh -p 5522' emails root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' css pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' images root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' docs pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' plugins root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' emails pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' sass root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' images pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' src root@risosrv:/var/www/$SERVERDIR_WEBSITE/ rsync -avz -e 'ssh -p 8822' plugins pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' .env.test.risosrv root@risosrv:/var/www/$SERVERDIR_WEBSITE/.env.test rsync -avz -e 'ssh -p 8822' sass pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 5522' package.json root@risosrv:/var/www/$SERVERDIR_WEBSITE/package.json rsync -avz -e 'ssh -p 8822' src --exclude 'server/router/upload' pcbuser@pcb:$DIRECTORY_SERVER/
rsync -avz -e 'ssh -p 8822' ecosystem.config.testriso.js pcbuser@pcb:$DIRECTORY_SERVER/ecosystem.config.js
rsync -avz -e 'ssh -p 8822' package.json pcbuser@pcb:$DIRECTORY_SERVER/package.json
echo "Sincronizzazione TERMINATA! - SERVER TEST!" echo "**************************"
echo "Sincronizzazione TERMINATA! - TESTSRISO.FREEPLANET_SERVER!"
echo "https://testriso.piuchebuono.app"
echo "**************************"

34
deploynodejs_on_test2.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
source ./.env.test2
echo "Directory attuale: $PWD"
msg="*** SERVER DI TEST2 **** SEI SICURO DI INVIARE GLI AGGIORNAMENTI SERVERSIDE (NODE JS) - SUL SERVER $SERVERDIR_WEBSITE (Y/N) ? "
if [ "$1" = "" ]; then
read -p "$msg" risposta
else
echo $msg
risposta=$1
fi
if [[ $risposta == "Y" || $risposta == "y" ]]; then
echo "Sincronizzazione in corso... $SERVERDIR_WEBSITE"
echo "Copiando .env.test2..."
rsync -avz -e 'ssh -p 8855' .env.test2 suryapaolo@servereng:/var/www/$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/
echo "Sincronizzazione TERMINATA! - SERVER TEST2!"
fi

0
docs/prova.txt Normal file
View File

View File

@@ -4,7 +4,10 @@ module.exports = {
name: "FreePlanetServerSide", name: "FreePlanetServerSide",
script: "./src/server/server.js", script: "./src/server/server.js",
ignore_watch : ["node_modules"], ignore_watch : ["node_modules"],
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
watch: false, watch: false,
//autorestart: true,
instances: 1,
env: { env: {
"PORT": 3000, "PORT": 3000,
"NODE_ENV": "development", "NODE_ENV": "development",
@@ -17,9 +20,9 @@ module.exports = {
"PORT": 3000, "PORT": 3000,
"NODE_ENV": "production", "NODE_ENV": "production",
}, },
log_file: "combined.outerr.log", log_file: "logs/combined.outerr.log",
error_file: "err.log", error_file: "logs/err.log",
out_file: "out.log", out_file: "logs/out.log",
merge_logs: true, merge_logs: true,
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z" log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
} }

22
ecosystem.config.testriso.js Executable file
View File

@@ -0,0 +1,22 @@
module.exports = {
apps : [
{
name: "TESTRISO2 FreePlanetServerSide",
script: "./src/server/server.js",
ignore_watch : ["node_modules"],
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
watch: false,
//autorestart: true,
instances: 1,
env_test: {
"PORT": 3001,
"NODE_ENV": "test",
},
log_file: "logs/combined.outerr.log",
error_file: "logs/err.log",
out_file: "logs/out.log",
merge_logs: true,
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
}
]
};

View File

@@ -19,66 +19,118 @@ html
} }
body(yahoofix, style="background: #ffffff") body(yahoofix, style="background: #ffffff")
- var baseimg = baseurl + '/statics/' - var baseimg = baseurl + '/'
span(id='body_style', style='display:block') span(id='body_style', style='display:block')
table(cellpadding="10", cellspacing="0", width="600", align="center") table(cellpadding="10", cellspacing="0", width="600", align="center")
tr tr
td(class="whitespace", height="10") td(class="whitespace", height="10")
p &nbsp; p &nbsp;
if (orders.items && orders.items.length > 0)
- var mystorehouse = orders.items[0].order.storehouse
else
- var mystorehouse = null
tr tr
td(class="emailContainer", valign="top") td(class="emailContainer", valign="top")
- var mioheader = mystorehouse.email_html_header
if (mioheader)
p!= mioheader
p Ciao #{username}, - var mioname = name
p Ti confermiamo che hai appena inviato un'ordine di prenotazione dei seguenti prodotti: if (!mioname)
- var mioname = user.username
p Ciao #{mioname},
tr if (orders.items[0].order.quantitypreordered > 0)
td(class="whitespace", height="10") - var miomakeorder = mystorehouse.email_html_GAS_makeorder
p &nbsp; else
- var miomakeorder = mystorehouse.email_html_makeorder
- var totalPrice = orders.totalPrice if (miomakeorder)
- var note = orders.note p!= miomakeorder
- var index = 0 else
p Ti arriverà una email quando i prodotti saranno disponibili per poterli venire a ritirare.
p Il pagamento, se non diversamente comunicato, potrai farlo direttamente in sede.
each product in orders.items
- var descr = product.order.product.name
- var img = product.order.product.img
- var price = product.order.price
- var after_price = product.order.after_price
- var qty = product.order.quantity
- index = index + 1
table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") tr
tr td(class="whitespace", height="10")
td(class="column", valign="center" width="40") p &nbsp;
p.boldhigh #{index}.
td(class="column sectionArticleImage", valign="top" width="150") - var totalPrice = orders.totalPrice
table(cellpadding="0", cellspacing="0", summary="", border="0") - var note = orders.note
tr - var index = 0
td
img(src=baseimg + img, alt="", width="150" height="150")
td(class="column", valign="top")
table(cellpadding="0", cellspacing="0", summary="", border="0") each rec in orders.items
tr - var descr = rec.order.product.productInfo.name
td(class="sectionContentTitle boldhigh", valign="top") - var img = rec.order.product.productInfo.img
p #{descr} - var price = rec.order.price
tr - var after_price = rec.order.after_price
td(class="sectionContent", valign="top") - var TotalPriceProduct = rec.order.TotalPriceProductstr
p Prezzo: #{price} € #{after_price} if (rec.order.gasordine)
tr - var gasordine = rec.order.gasordine.name
td(class="sectionContent", valign="top") else
p Quantità: #{qty} - var gasordine = ''
- var qty = rec.order.quantity
- var qtypreordered = rec.order.quantitypreordered
if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered * rec.order.product.productInfo.weight
else if (rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight
p Note Aggiuntive: #{note} - var unit = rec.order.product.productInfo.unitstr
- index = index + 1
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} € table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr
td(class="column", valign="center" width="40")
p.boldhigh #{index}.
td(class="column sectionArticleImage", valign="top" width="150")
table(cellpadding="0", cellspacing="0", summary="", border="0")
tr
td
img(src=baseimg + img, alt="", width="150")
td(class="column", valign="top")
table(cellpadding="0", cellspacing="0", summary="", border="0")
if (qtypreordered > 0)
tr
td(class="sectionContent", valign="top")
p Gas Ordine: #{gasordine}
p &nbsp;
tr
td(class="sectionContentTitle boldhigh", valign="top")
p #{descr}
tr
td(class="sectionContent", valign="top")
p Prezzo: #{price} € #{after_price}
if (qty > 0)
td(class="sectionContent", valign="top")
p Quantità: #{qty} #{unit}
if (qtypreordered > 0)
td(class="sectionContent", valign="top")
p Quantità Prenotata: #{qtypreordered} #{unit}
tr
td(class="sectionContent", valign="top")
p Totale: #{TotalPriceProduct} €
if (note)
p Note Aggiuntive: #{note}
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
tr tr
td(class="whitespace", height="10") td(class="whitespace", height="10")
p Ti arriverà una email quando i prodotti saranno disponibili per poterli venire a ritirare. tr
p Il pagamento potrai farlo direttamente in sede. td
p Grazie Mille - var miofooter = mystorehouse.email_html_footer
if (miofooter)
p!= miofooter
else
p Grazie Mille
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr tr

View File

@@ -28,7 +28,12 @@ html
tr tr
td(class="emailContainer", valign="top") td(class="emailContainer", valign="top")
p Ciao #{name}, - var mioname = name
if (!mioname)
- var mioname = user.username
p Ciao #{mioname},
p L'ordine è stato Cancellato. p L'ordine è stato Cancellato.
p Se è stato un errore, procedi a ripetere l'Ordine, ripartendo dalla lista prodotti. p Se è stato un errore, procedi a ripetere l'Ordine, ripartendo dalla lista prodotti.
p Grazie Mille p Grazie Mille

View File

@@ -1,80 +0,0 @@
doctype html
html
head
title Ordine Completato
//- import css/scss stylesheets
//- these file names will be replace by gulp with proper css file paths
link(rel="stylesheet", href="../sass/basic.scss")
link(rel="stylesheet", href="../sass/one/styles.scss")
//- embdedded css allowed, but not sass
style.
.red {
background-color: #E84C50;
}
.full-width {
width: 100%;
}
body(yahoofix, style="background: #ffffff")
- var baseimg = baseurl + '/statics/'
span(id='body_style', style='display:block')
table(cellpadding="10", cellspacing="0", width="600", align="center")
tr
td(class="whitespace", height="10")
p &nbsp;
tr
td(class="emailContainer", valign="top")
p Ciao #{name},
p L'ordine n. #{ordernumber} è stato Completato correttamente !
p Grazie Mille per aver contribuito a far crescere la Comunità
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr
td(class="whitespace", height="10")
p &nbsp;
tr
td.firma
p!= dataemail.firma
tr
td.disclaimer
p!= dataemail.disclaimer_out
tr
td.bottom
p!= dataemail.disc_bottom_out
tr
td(class="whitespace", height="10")
p &nbsp;
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
p {
font-size: 1rem;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -1 +0,0 @@
=`Ordine n. ${ordernumber} Completato`

View File

@@ -1,7 +1,7 @@
doctype html doctype html
html html
head head
title Ordine Confermato title Ordine n. #{ordernumber} Confermato
//- import css/scss stylesheets //- import css/scss stylesheets
//- these file names will be replace by gulp with proper css file paths //- these file names will be replace by gulp with proper css file paths
@@ -19,32 +19,65 @@ html
} }
body(yahoofix, style="background: #ffffff") body(yahoofix, style="background: #ffffff")
- var baseimg = baseurl + '/statics/' - var baseimg = baseurl + '/';
span(id='body_style', style='display:block') span(id='body_style', style='display:block')
table(cellpadding="10", cellspacing="0", width="600", align="center") table(cellpadding="10", cellspacing="0", width="600", align="center")
tr tr
td(class="whitespace", height="10") td(class="whitespace", height="10")
p &nbsp; p &nbsp;
if (orders.items && orders.items.length > 0)
- var mystorehouse = orders.items[0].order.storehouse
else
- var mystorehouse = null
tr tr
td(class="emailContainer", valign="top") td(class="emailContainer", valign="top")
p Ciao #{name}, - var mioheader = mystorehouse.email_html_header
p L'ordine dei seguenti prodotti è stato Confermato: if (mioheader)
p!= mioheader
- var mioname = name
if (!mioname)
- var mioname = user.username
p Ciao #{mioname},
if (orders.items[0].order.quantitypreordered > 0)
- var miordconfirmed = mystorehouse.email_html_GAS_order_confirmed
else
- var miordconfirmed = mystorehouse.email_html_order_confirmed
if (miordconfirmed)
p!= miordconfirmed
else
p Puoi pertanto venire a ritirarli direttamente in sede, negli orari che ti sono stati indicati.
tr
td(class="whitespace", height="10")
p &nbsp; p &nbsp;
- var totalPrice = orders.totalPrice - var totalPrice = orders.totalPrice
- var note = orders.note - var note = orders.note
- var index = 0 - var index = 0
each product in orders.items each rec in orders.items
- var descr = product.order.product.name - var descr = rec.order.product.productInfo.name
- var img = product.order.product.img - var img = rec.order.product.productInfo.img
- var price = product.order.price - var price = rec.order.product.price
- var after_price = product.order.after_price - var after_price = rec.order.product.after_price
- var qty = product.order.quantity if (rec.order.gasordine)
- var gasordine = rec.order.gasordine.name
else
- var gasordine = ''
- var qty = rec.order.product.quantity
- var qtypreordered = rec.order.quantitypreordered
if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered * rec.order.product.productInfo.weight
else if (rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight
- var unit = rec.order.product.productInfo.unitstr
- var TotalPriceProduct = rec.order.TotalPriceProductstr
- index = index + 1 - index = index + 1
table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
@@ -56,29 +89,48 @@ html
table(cellpadding="0", cellspacing="0", summary="", border="0") table(cellpadding="0", cellspacing="0", summary="", border="0")
tr tr
td td
img(src=baseimg + img, alt="", width="150" height="150") img(src=baseimg + img, alt="", width="150")
td(class="column", valign="top") td(class="column", valign="top")
table(cellpadding="0", cellspacing="0", summary="", border="0") table(cellpadding="0", cellspacing="0", summary="", border="0")
if (qtypreordered > 0)
tr
td(class="sectionContent", valign="top")
p Gas Ordine: #{gasordine}
p &nbsp;
tr tr
td(class="sectionContentTitle boldhigh", valign="top") td(class="sectionContentTitle boldhigh", valign="top")
p #{descr} p #{descr}
tr tr
td(class="sectionContent", valign="top") td(class="sectionContent", valign="top")
p Prezzo: #{price} € #{after_price} p Prezzo: #{price} € #{after_price}
if (qty > 0)
tr
td(class="sectionContent", valign="top")
p Quantità: #{qty} #{unit}
if (qtypreordered > 0)
tr
td(class="sectionContent", valign="top")
p Quantità Prenotata: #{qtypreordered} #{unit}
tr tr
td(class="sectionContent", valign="top") td(class="sectionContent", valign="top")
p Quantità: #{qty} p Totale: #{TotalPriceProduct} €
p Note Aggiuntive: #{note} if (note)
p Note Aggiuntive: #{note}
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} € p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
tr tr
td(class="whitespace", height="10") td(class="whitespace", height="10")
p Puoi pertanto venire a ritirarli direttamente in sede. tr
p Grazie Mille td
- var miofooter = mystorehouse.email_html_footer
if (miofooter)
p!= miofooter
else
p Grazie Mille
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr tr
td(class="whitespace", height="10") td(class="whitespace", height="10")

View File

@@ -0,0 +1,179 @@
doctype html
html
head
title Ordine n. #{ordernumber} Consegnato
//- import css/scss stylesheets
//- these file names will be replace by gulp with proper css file paths
link(rel="stylesheet", href="../sass/basic.scss")
link(rel="stylesheet", href="../sass/one/styles.scss")
//- embdedded css allowed, but not sass
style.
.red {
background-color: #E84C50;
}
.full-width {
width: 100%;
}
body(yahoofix, style="background: #ffffff")
- var baseimg = baseurl + '/';
span(id='body_style', style='display:block')
table(cellpadding="10", cellspacing="0", width="600", align="center")
tr
td(class="whitespace", height="10")
p &nbsp;
if (orders.items && orders.items.length > 0)
- var mystorehouse = orders.items[0].order.storehouse
else
- var mystorehouse = null
tr
td(class="emailContainer", valign="top")
- var mioheader = mystorehouse.email_html_header
if (mioheader)
p!= mioheader
- var mioname = name
if (!mioname)
- var mioname = user.username
p Ciao #{mioname},
p L'ordine n. #{ordernumber} è stato Consegnato correttamente 📦 !
p Grazie per averci scelto 🙏🏻 e alla prossima !
p &nbsp;
if (orders.items[0].order.quantitypreordered > 0)
- var miomakeorder = mystorehouse.email_html_GAS_order_consegnato
else
- var miomakeorder = mystorehouse.email_html_order_consegnato
if (miomakeorder)
p!= miomakeorder
- var totalPrice = orders.totalPrice
- var note = orders.note
- var index = 0
each rec in orders.items
- var descr = rec.order.product.productInfo.name
- var img = rec.order.product.productInfo.img
- var price = rec.order.product.price
- var after_price = rec.order.product.after_price
if (rec.order.gasordine)
- var gasordine = rec.order.gasordine.name
else
- var gasordine = ''
- var qty = rec.order.product.quantity
- var qtypreordered = rec.order.quantitypreordered
if (rec.order.product.productInfo.sfuso && rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered * rec.order.product.productInfo.weight
else if (rec.order.product.productInfo.weight)
- qtypreordered = qtypreordered + ' x ' + rec.order.product.productInfo.weight
- var unit = rec.order.product.productInfo.unitstr
- var TotalPriceProduct = rec.order.TotalPriceProductstr
- index = index + 1
table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr
td(class="column", valign="center" width="40")
p.boldhigh #{index}.
td(class="column sectionArticleImage", valign="top" width="150")
table(cellpadding="0", cellspacing="0", summary="", border="0")
tr
td
img(src=baseimg + img, alt="", width="150")
td(class="column", valign="top")
table(cellpadding="0", cellspacing="0", summary="", border="0")
if (qtypreordered > 0)
tr
td(class="sectionContent", valign="top")
p Gas Ordine: #{gasordine}
p &nbsp;
tr
td(class="sectionContentTitle boldhigh", valign="top")
p #{descr}
tr
td(class="sectionContent", valign="top")
p Prezzo: #{price} € #{after_price}
if (qty > 0)
tr
td(class="sectionContent", valign="top")
p Quantità: #{qty} #{unit}
if (qtypreordered > 0)
tr
td(class="sectionContent", valign="top")
p Quantità Prenotata: #{qtypreordered} #{unit}
tr
td(class="sectionContent", valign="top")
p Totale: #{TotalPriceProduct} €
if (note)
p Note Aggiuntive: #{note}
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
tr
td(class="whitespace", height="10")
tr
td
- var miofooter = mystorehouse.email_html_footer
if (miofooter)
p!= miofooter
else
p Grazie Mille
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr
td(class="whitespace", height="10")
p &nbsp;
tr
td.firma
p!= dataemail.firma
tr
td.disclaimer
p!= dataemail.disclaimer_out
tr
td.bottom
p!= dataemail.disc_bottom_out
tr
td(class="whitespace", height="10")
p &nbsp;
style(type="text/css").
html, body {
padding: 0;
margin: 0;
}
p {
font-size: 1rem;
}
.divbtn {
display: flex;
align-items: center;
justify-content: center;
}
.btn-lg {
padding: 5px;
margin: 5px;
font-size: 26px;
cursor: pointer;
color: white;
background: #027be3 !important;
border-radius: 28px;
}

View File

@@ -0,0 +1 @@
=`Ordine n. ${ordernumber} Consegnato`

View File

@@ -11,46 +11,42 @@
-} -}
- var urlcal = baseurl + '/calendario-eventi/' - var urlcal = baseurl + '/calendario-eventi/'
- var imginstagram = baseurl + '/statics/images/images/footer-instagram-icon.png' - var imginstagram = baseurl + '/images/images/footer-instagram-icon.png'
- var imgtwitter = baseurl + '/statics/images/images/footer-twitter-icon.png' - var imgtwitter = baseurl + '/images/images/footer-twitter-icon.png'
- var imgyoutube = baseurl + '/statics/images/images/footer-youtube-icon.png' - var imgyoutube = baseurl + '/images/images/footer-youtube-icon.png'
- var imgfb = baseurl + '/statics/images/images/footer-facebook-icon.png' - var imgfb = baseurl + '/images/images/footer-facebook-icon.png'
- var baseimg = baseurl + '/statics/' - var baseimg = baseurl + '/'
doctype html doctype html
html html
head - if (dataemail.title)
title Calendario Eventi head
title dataemail.subject
//- import css/scss stylesheets //- import css/scss stylesheets
//- these file names will be replace by gulp with proper css file paths //- these file names will be replace by gulp with proper css file paths
link(rel="stylesheet", href="../sass/basic.scss") link(rel="stylesheet", href="../sass/basic.scss")
link(rel="stylesheet", href="../sass/one/styles.scss") link(rel="stylesheet", href="../sass/one/styles.scss")
//- embdedded css allowed, but not sass //- embdedded css allowed, but not sass
style. style.
.red { .red {
background-color: #E84C50; background-color: #E84C50;
} }
.full-width { .full-width {
width: 100%; width: 100%;
} }
body(yahoofix) body(yahoofix)
span(id='body_style', style='display:block') span(id='body_style', style='display:block')
table(class="preheader", cellpadding="0", cellspacing="0", width="100%")
tr
td.webversion
p non vedi le immagini?&nbsp;
a(href=urlcal) Apri il Calendario
table(class="topHeader", cellpadding="0", cellspacing="0", width="100%") table(class="topHeader", cellpadding="0", cellspacing="0", width="100%")
tr - if (dataemail.height_logo)
td tr
table(cellpadding="0", cellspacing="0", align="center", summary="") td
tr table(cellpadding="0", cellspacing="0", align="center", summary="")
td.logoContainer tr
a(href=baseurl, title='logo') td.logoContainer
img.logo(src=baseurl+"/statics/images/logo.png", height=dataemail.height_logo) a(href=baseurl, title='logo')
img.logo(src=baseurl+"/images/logo.png", height=dataemail.height_logo)
tr tr
td.testomail td.testomail
@@ -61,17 +57,17 @@ html
td.clpromo td.clpromo
p!= dataemail.textpromo p!= dataemail.textpromo
- if (dataemail.templ.content) - if (dataemail.templ.content)
table(cellpadding="0", cellspacing="0", width="95%", align="center") table(cellpadding="0", cellspacing="0", width="95%", align="center")
tr tr
td(class="textIniContainer", valign="top") td(class="textIniContainer", valign="top")
p!=dataemail.templ.content p!=dataemail.templ.content
- if (dataemail.templ.img) - if (dataemail.templ.img)
img(src=baseimg + dataemail.templ.img, alt="", class="myimg") img(src=baseimg + dataemail.templ.img, alt="", class="myimg")
- if (dataemail.templ.content2) - if (dataemail.templ.content2)
p!=dataemail.templ.content2 p!=dataemail.templ.content2
- if (dataemail.templ.img2) - if (dataemail.templ.img2)
img(src=baseimg + dataemail.templ.img2, alt="", class="myimg") img(src=baseimg + dataemail.templ.img2, alt="", class="myimg")
table(cellpadding="0", cellspacing="0", width="640", align="center") table(cellpadding="0", cellspacing="0", width="640", align="center")
- if (dataemail.templ.options.includes('SHOW_EVENTS')) - if (dataemail.templ.options.includes('SHOW_EVENTS'))
@@ -201,10 +197,6 @@ html
td(class="whitespace", height="20") td(class="whitespace", height="20")
p &nbsp; p &nbsp;
tr
td(class="whitespace", height="20")
p &nbsp;
// Social Media // Social Media
table.socialMedia(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center") table.socialMedia(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
tr tr

View File

@@ -93,3 +93,76 @@ Gio 12/10 ORE 15:06: USER [paoloar77]: bottone
Ven 13/10 ORE 11:05: USER [SuryaArena]: bottone Ven 13/10 ORE 11:05: USER [SuryaArena]: bottone
Ven 13/10 ORE 11:40: USER [SuryaArena]: bottone Ven 13/10 ORE 11:40: USER [SuryaArena]: bottone
Dom 17/12 ORE 15:38: USER [admin]: prova
Dom 17/12 ORE 16:18: USER [admin]: vai al sito
Dom 17/12 ORE 16:19: USER [admin]: vai al sito
Dom 17/12 ORE 16:19: USER [admin]: il mio profilo
Dom 17/12 ORE 16:19: USER [admin]: prova
Dom 17/12 ORE 16:19: USER [admin]: link da condividere
Sab 30/12 ORE 20:06: USER [admin]: gruppo di acquisto per le arance:
produttore:
🍊sicilia frutta express (catania)
la piccola azienda a conduzione familiare di giovanni si trova in provincia di catania (sicilia), i frutti vengono prodotti rispettando i principi della biodinamica infatti non viene utilizzato nulla di chimico (niente irrorazioni) e la concimazione avviene tramite concimi naturali (letame).
⚠️ offerta sconto valida solo fino al 3 gennaio 2024, raggiungendo 100 kg totali di ordini di arance:
i prezzi sono compresi di spese di spedizione e di gestione.
🍊 arance tarocco spremuta: 1,20 € / kg
🥑 avocado: 7,80 € / kg
🍋 limoni: 2,40 € / kg
👉🏻 entra sul gruppo telegram piu che buono
per le prenotazioni potete registratevi sul nuovo sito:
👉🏻 piu che buono - gas e bottega (piuchebuono.app)
come funziona:
- registratevi su piuchebuono.app, verificate la email.
- accedete e poi cliccate su "gruppo di acquisto".
- cliccate sul carrello verde 🛒 per aggiungere i kg che desiderate.
- per finire: cliccare su "procedi all'ordine" e confermate.
Dom 21/01 ORE 19:00: USER [paoloar77]: 👉🏻 indietro
Mar 23/04 ORE 22:31: USER [paoloar77]: ciao
Mer 24/04 ORE 20:45: USER [paoloar77]: invia a paolo
Mer 24/04 ORE 20:45: USER [paoloar77]: 📨 invia a paolo
Mer 24/04 ORE 20:58: USER [paoloar77]: grass e prova italic
Mer 24/04 ORE 21:19: USER [paoloar77]: 👍 si
Mer 24/04 ORE 22:02: USER [paoloar77]: ✅ la regolarizzazione può avv
Mer 24/04 ORE 22:15: USER [paoloar77]: ❗importante❗
💚🍚 cari membri dei circuiti ris,
quando siete entrati nel vostro circuito territoriale, avete dichiarato di avere letto e approvato il regolamento di funzionamento dei circuiti ris.
📖 leggi qui il regolamento (https://riso.app/regolamento)
il gruppo dei facilitatori territoriali di riso ha individuato un punto che necessita di chiarimenti, per rendere più esplicito un meccanismo già presente nel testo stesso. propone dunque di aggiungere una nota esplicativa (vedi asterisco *) alla seguente frase del regolamento (indicata in corsivo):
➡️ "… ciascun detentore di un saldo negativo concorda che la sua esposizione funge da garanzia della quantità di ris equivalenti circolanti nel circuito e che può essere chiamato a regolarizzare con equivalente pagamento in euro * , entro un lasso di tempo ragionevolmente adeguato, nel caso in cui: la comunità, in accordo con il gruppo tecnico, deliberi il rientro di alcune posizioni con decisione motivata; lutente decida di uscire per motivi personali; il circuito chiuda, per decisione deliberata o per motivi di forza maggiore.”
✅ * la regolarizzazione può avvenire con equivalente valore in beni e servizi, oppure, in ultima istanza, con pagamento in euro.
📣 invitiamo tutti a prendere visione della proposta, e ad esprimere eventuali osservazioni nel gruppo territoriale, oppure come commento a questo stesso post, pubblicato sul canale progetto riso, entro il giorno 5 maggio
https://t.me/riso_canale/739
in attesa di riscontri, salutiamo! 🍚💚
il gruppo dei facilitatori territoriali riso

View File

@@ -24,4 +24,815 @@ Ven 29/09 ORE 23:18: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
Mar 03/10 ORE 22:49: 🤖: Da Sùrya (Paolo) undefined (paoloar77): Mar 03/10 ORE 22:49: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)! ✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
Sab 04/11 ORE 15:17: 🤖: Da Sùrya (Paolo) undefined (paoloar77): Sab 04/11 ORE 15:17: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)! ✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
Sab 02/12 ORE 14:15: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
✅ SuryaArena è stato Abilitato correttamente (da paoloar77)!
Dom 21/01 ORE 19:00: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
👉🏻 indietro
Gio 28/03 ORE 18:10: 🤖: Da Sùrya (Paolo) undefined (paoloar77):
✅ prova123 è stato Abilitato correttamente (da paoloar77)!
Mar 23/04 ORE 22:33: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:33: 0 ✉️ Messaggi da Inviare
Mar 23/04 ORE 22:33: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:38: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:41: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:41: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:42: APPARTIENE_CIRCUITO_RIS:
contasolo
Mar 23/04 ORE 22:42: 703 ✉️ Messaggi da Inviare
Mar 23/04 ORE 22:44: APPARTIENE_CIRCUITO_RIS:
nomecognome
Mar 23/04 ORE 22:44: Paolo Surya(paoloar77)
Sergio Mazzanti(sergiomazzanti)
Alberto Sensoli(Alberto)
Fabri (FabriNunzia)
Sabrina Siri(SabrinaCucovaz)
Lorenzo Essente(LorenzoVT)
Gianni Recca(Gianni)
Giovanni (Surfman)
Lucia (Lucente)
(Angerita)
(giancarloscarva)
Fabrizio Erani(fabris64)
(Dena1703)
(Aja)
Max Feraco(Joymax68)
(marcela)
Vittorio Falegname(Falegname.Vittorio)
(Fanny22)
(ostecippa)
Maria Pecoraro(pecorablu)
Talia Felin(Eaglefly)
Barby (Bbarbi)
Vincenzo Demaio(vincidemi)
Loretta (lunaloretta)
Isabella (SognoAltea)
Tempo di Vivere(tempodivivere.it)
(Agotrip)
Camillo Granchelli(Kami66)
Antonio Graziano(Tonygraziano)
(Ambessa)
MarinaA (MarinaA)
Carmine Cozzolino(Cicciomu)
Angela (Angelare)
Valentina Portelli(Nonnapapera)
Andrea Bozzetto(abozzetto)
BCMassimo (BCMassimo)
Denis Vignocchi(Denis1970)
(Ladycocca)
Erica Brunello(Ericabru)
Marina S.(Marina22)
(Serena.Tre.Stelle)
(antonioscioscia)
Irene (IreneVit)
Shakuntala Tiziana Riva(Shakuntala)
(Rosablu)
silvia (silvia7)
(Rosanna)
(Lamary)
Luca Sartini(Sarto1978)
(Fabiozero)
(stefanci87)
Raffaella Bonino(Spirale)
(Paola_Cr)
Elena Turilli(ballerina2909)
Luisa Recchia(LuisaRecchia)
Enrico Cantamessa(Enrico_Cantamessa)
(MariaMasterReiki)
Bianca Prugna(BiancaPrugna)
Silvia Ruggieri(Liberalux)
Erica (erica57)
laura nocera(laura.nocera)
Federico (eremita222)
(Versolaluce)
Alejandro (alecanque)
(Mauro_EL)
Gaetano (GaetanoSant)
Natalia (Natalia)
Stefania (StefaniaSantag)
Giuliana Car(Guglielmina)
Georgia Matteini Palmerini(GeorgiaMP)
(saraprinc)
(iosonoio58)
(Ennepi)
Silvia lorenza (Silvia88)
(Messaggero6)
(Carlos)
Federico Palla(FedePallaLUMEN)
Laura Salvetti(Laura5)
Ciro (Riccardo)
Sabrina (Sabrinap)
Samuele Mastelloni(SamuelMast)
Francesca Puppo(Open.curious)
Simona Teresa Maria(SimonaPt)
(Mila-Roberto)
Antonella Scrittrice ecologia quantica(Antoquantica)
Samuele Canestri(Evoluzionari)
Arcangelo Casavola(arca33)
Roberta Annecchino(Roberlina)
Antonio Daniele(Antonio_N)
(AlessioColombo)
(Varia9)
(MagiaMirtilla)
Emilie Vandecandelaere(Emilie)
(Natasha)
(marino222)
(Moscadri)
Rosanna Fantucci(Roxanne)
(Andrea_Tiziana)
(Ritacam)
Michela (michelaC)
(DomSap)
(L4il4-F)
(Luisaaa)
(Fly89it)
(Annarosa)
Nino (Ninosella)
(Rosedane)
(Marafox)
RitaLuisa (RitaLuisa)
(Frimel)
Sergio (Precisin)
(torneremoaballare)
(pier_luigi_c)
Stella (stella)
Silvia (LaBrighid)
(marcelloaloe)
(Angisan21)
Elena (RosEle70)
(tilliutaio)
Tera (tera0861)
(gradar83)
Alberto Soverchia(ThinkererSan)
Viviana (Viviamarespira)
Fulvio Faro(Fulvio_F)
Valeria Pastorino(Valeriapastorino)
(Robynora)
(FrancyVeg72)
inTuiziana (TiziaKaja)
(rit_ale)
(Cyberobe)
(MaxCerba)
(zelda23)
Flavia (flaviaoak)
Mario Romeo(zacc50)
Samuela (Fioridisole)
(cristianodisotto)
Zeo (ZeoPleiadi)
Ina (lafenjce)
(Almaelena)
(Robertocnm)
(Grazia_22)
(Ebiker2000)
(JulienQ)
Stefania (Metanoeite1973)
(texdb70)
(LauraRosaMarina)
(Francyjones)
(raffaele_costi)
(RobertoCutillo)
(Nicmestre)
(Ellis92)
(RobertoDCC)
(armoniaserena)
(Tris2_0)
Davide (Metonimia)
Elena Esposito(ElenaEspx)
Roberto Nicolè(Bobobasss)
Maria Rosa Favaro(Cheggioya)
(Atmapriya64)
Manuela (calendola)
(santonimarco)
Andrea Roncolini(barbaronx)
(Elisagranello)
Daniela (dania63)
(EtruscanStateless)
(Barbara_Nrd)
(ClaudiaMariaRosaria)
Vivien Russo(vivienru)
(Borgomaestro)
(letiziaferro)
Donatella Parrini(siena1)
Patripadova (patripadova)
(pomps61)
(COFEINA)
Monica (Monicainviaggio)
(Marititti)
(IreneRocca37)
(JwalaRegina)
(An_el_a)
Antonio Ciurlia(joliker)
virna (donnacustodedelfuoco)
Alessandra (ale_21giugno)
(Sante2015)
(Alestrale)
Michele Padula(Michele_pm)
(ritarevathy)
Barbara Bonora(BarbaraBonora)
Claudio Galassi(Jalsha2)
(sganapigi)
(gassuper3)
(Cibuk176)
(Naliber)
Cinzia (cavaioni)
(Riflessivo33)
Erica Rosselli(Erica_Grace)
(Nun988)
(SimonettaSecchi)
(mauribeni)
(Ambrig)
Fritz Baehler(Fritz_Baehler)
(AndreaLemon)
(simonetta63)
(Laura_C61)
Alicia Atzori(aliciaedu)
Fede Faith (FedeFaith)
(ElisV73)
(VentoDiCambiamento)
Concetta (Concyrau)
Claudio (KenHunter)
(danielaw63)
(Antonio_Ferrandes)
Giacomo (Unicorno_Giacomo)
Federica Rizzi(FedericaFezz)
JESSICA SHANTA DEVI (JessicaShantaDevi)
(Alessia17love)
Valeria (Rondinell)
(Sidereo1)
(Maia_73)
Michele (M.Cicl8)
Giusi Uc (ARGOGU)
Giuseppe (iceborg500)
Adriano Lai(AL72MB)
Bodhitara (primotintorosso)
Daniela Enrico(dan7se)
Carmela (carvas5)
Ines (Ineswild)
Mariana (Mepar68)
Fulvio Maresca(Fulvi00)
Barbara M(Mnbo_7198)
(Valentinabiodanzamindfulness)
Luca Moretti(lucamop)
Thor (ThorHammering)
Laura Sc(LadyLauraSC)
(AuryEdy)
Tiziana Rimondi(pioggia8)
Lara (trotttola)
Alessandra Scotti(SulleAliDelCambiamento)
Barbarastefania Ruta(matucnv)
Stefano (step1608)
(avvdona)
Fabioa (fabioa_a)
(MauMac95)
(Millyfor)
(edda47)
Renzo (Renzosan7)
Monia Camillini(monia69)
(ottofeel)
Loretta Rocchi(Blu_ris)
Manuela69 (arcobalen8)
Elizabeth (Elizabeth884)
Silvia M(silvia418)
Patrizia Zucchini(reiki1959)
Francesco Rosa(franz12090)
Susanna L(Susann1na)
(Stonelpluriverso)
Silvia Tog(silviatog)
Loretta Z(Nove_mbre)
Manuel Venturi(Manuel84d)
Massimo Longati(Tranquillio)
Emanuela (mondobiblio)
(salute_yoga)
Angela M.(Quanyin08)
Sokol (LokoSaK)
Nicole (NikkiZilli)
Alberto Mengoni(Alberto_Mengoni)
Jen B(Jenny_B)
Laura Latticini(Lauralatt)
Davide Mazzavillani(MazzavillaniDavide)
Valerio D'alessio(Valerix64)
Anna Bellet(Naanbe)
Laura (lauraghini)
Fabio Panciera(FabioPnc)
Antonio (Napoleone2)
Pianta (Didonemma)
Annarita (TortellinaZen16)
Maria Garofalo(marygary71)
Girolamo (teacarfu)
Erica (ericaalberonido)
Eleonora Mora(EleVegan)
Ciro Famiglietti(cirofamigliettivegan)
Andrea (carpis77)
Sandra Zamboni(alessandramondo)
Federico (FedeSo72)
(Dilu_69)
Sonia Boni(Sonia28358)
Su Fiu(SusanFiu)
(Debbiesole)
(Sole_4gatti)
Ugo Maccaferri(Cavallo1011)
Gabriella (gabriella_bologna)
(Natural_68)
Daniela De Simone(DanielaDeSimone)
Katia (Katia_g83)
David Martinī(Davidcasaviva)
Milvia (Mil2227)
Susi (frida71)
Romina Martini(rominamartini)
Deborah (ilventoeilbambu)
Daniela Rogue5(Rogue571)
Federico Paci(spadroneggio)
Giusy ❤️ (giusylove)
Giovanbattista Romano(Gianni_Romano_Coach)
Ferdy (fernandoaloise)
Laura Galli(Laurastella8)
Leonardo (marconeuno)
Arianna (AriannaTurchi)
(Teresabmt)
Matteo (Gandalf_il_verde)
Alberto (AlbertG11)
(EnryZord)
Genoveffa Chiummo(louis_thelbri)
Vanda (Vandanatalina)
Dino Stella(Dinostella)
Paola (Ubuntu75)
Simone (DottorMaxillo)
Lina Giardina(linagia)
Rosaria (RosariaM23)
Maurizio (mauriziola)
Zacerchiataf (ZacerchiataF)
Tiziana (tiziada)
Nino (Cascant17)
Tom (Tom21me)
Franco Ciccio(Cicciofranco1964)
Elena (Lanatama)
Rossella (Animalibera62)
Caterina (lcaterina)
Adelina (Adelinafo)
Cat (CatCat969)
Lor (Lori_2)
Giancarlo (giancalopresti)
Maria Angela (masavoca)
Francesco Musumeci(francescomusumeci7)
Stefania (cucunci)
Giusy Iam(giusyfashion)
Maria Antonietta (noirginger)
Angelo Spitale(AngeloSPIT)
Sergio (sergiookarte)
Daniele (DanieleSantinoA)
Ermete Trismegisto(Ermete)
Angela Raffaele(Angela_rfl)
Vincenzo Torrisi(V1nce22)
Mimmo Aloisio(Mimmutsu)
Clelia Acireale (Cleocost)
Margherita Fassari(MargheritadiCanalicchioterramore)
Orazio (Orazio369)
Consuelo (Consuelo_Messina)
Daniela (Maemouna)
Max Are(Edificium)
Sebastiano (Vera1169)
Merope (Merope)
Giuli (giuliperilla)
Valentina Pica(AttivacreaVale)
Silvia Grilli(silviagrilli)
Giuseppe (Gilgamesh72)
(irenect)
Alice_zen 🌺 (alice_zen)
totò Grilletto(totogrilletto)
Emilia (Emilia6613)
Lorella (Corivitto)
Giusy (Giuppass)
Pamela (Q709fok)
Salvatore Lo Giudice(Haku_tato)
Giuseppina (Giuscrescim)
Gaetano (Gaetano)
Luigi (IAM09111967)
Roberto (RobertoAudio)
(Michele_Libero)
Monica Sapio(monicasapio)
Armando Lembo(harlem8)
Simona (SimonaTrinart)
Gianpiero (GianpieroC)
Maria (MariaCal14)
Antonio (antonio338)
(RaffaellaBeauty)
Antonino Castronovo(AntonAC)
Andrea (Ubanjix)
Marit (Scineve)
Stefania Castagnozzi(Blue_Lagoon_111)
lorenzo cambria(lorsindi)
Rossella Cazzaniga(canoneinversotappeti)
Antonella Ciucci(lantoanto)
Stefano Viola(stef1269)
Cla (Sesamo)
Dario (Liune64)
Leonardo (leonardoloscalzo)
Giovanni Gorgone(giovannigorgone)
Serena Giudici(mammamago)
m.irene (irene13angeli)
(moretta369)
Damiano Lupezza(Damiano)
Daniele (SistemaCorrotto)
Sara Eligio(sarakey73)
Stefilibera (Stefilibera)
Francesca (es_pery15)
Edel (Passinelsole)
Marco (tyrchyus)
Silvia (sillabasibilla)
Simona Curatolo(Simona_CreaIdeando)
(MarySaraJane)
Monica (Merylav)
Daniela (Jessiremi)
Michela (Cive_13)
Monique (Quattropeli)
Leonardo (ldproma)
Lauram (Laura7117)
Armando Dolcini(adolcini)
Giorgia Rita Zanellato(Giory73)
Stefania (Stefyzann)
Riccardo (RikyBalboa)
Simona Meazzini(SimonAyurveda)
Leda (altre_vie)
Oreste (Forrest81)
Roberta Carluccio(Famcarluccio)
Inge369 (Inge369)
Marzel M(zecastighetor)
(Vetromile1975)
Cinzia (Red_Naomi8)
(natalina_candelo)
Roberta (Ro_by7)
Giovanna Moretti(Giom.VT)
Cristina Marinelli(criss71)
Sabrina (SabrinaStrozzi)
Stefano Francesco Piva(Steve31958)
Giacomo Bortoluzzi(JackBorto)
Ileana Ziani(Ileana63)
Marco (Marketto)
Raffaella (roverella19)
(ptommaso90)
Grace (acia75)
Giuliana B(GiulianaB88)
Mariella (Mariella_Pichi)
Marina Fiori(fiorimarina)
(AngelaEnzingara)
Cucu (Peterin0)
(Eledibe)
David Fogazza(DavFog)
Giulia (julybi)
Federica (Federicas04)
Spyke Jones(SpykeJones)
(ElenaLc)
Ines Carlu(ineesee)
Vivy x BORGO cohousing (vivy_BORGO_cohousing)
(Nocciolo)
Stefano (Stefano_93)
Emilio Costantino Belmonte(iTecnologici)
(ClaudProv)
(CarFlora)
Angelo (cavallo62)
Marco (Marlet)
Donata Guerci(Dona_1971)
(stefanoTS)
Lucie (Lu_Ma_03)
Lorenza Beltrami(Lorenz_Lo)
Claudia Barontini(CB1972)
Paola Medeot(Paolamedeot)
(LiberaValente)
Roberto Sorato(Roby81)
Carla (ribeka786)
Nunzio (Nunzio1980)
Alessandro Cavalli(Alecava496)
Daniela Lazzarotto(daniela1511)
Silvia Santagata(Silvia121Artist)
(Tzilli_0)
Alessandra (alessandrapiani)
Antonia Bianco(biancainot)
Nadia (Speranza10)
Mimmo (MimmoUstica)
Claudio Panicali(ClaudioDellaCoscienza)
Raga (Ragaliliana)
Anna D'acunio(annadac61)
Ippolito (Ippolito)
Sabrina Aguiari(sabracadabrax)
Milena (milly4always)
Damiano Furlan(FurioShin)
Angela Rebeschini(dunia_iride)
Fabio (Fabiobrent)
Anna (AllaLuce)
Chiara (chiara821)
(Silvielli)
Sandra (Ildega)
Marco Campisano(Marcoscimmia)
(Maicolnait)
Nadia T.(Nadia_348)
Alessandro Grasso(tutarancio)
Riccardo Menolotto(riccardomenolotto)
Luisa (luisageromet)
(lollo22k)
Fulvio Tango(AirblueFulvio)
Mattia Bondi(MattiaBondi)
Enza Restuccia(Vinrest22)
(visvital)
Piero Mazza(piterpm)
Valentina Benedetti(ValeCipcip)
Angelo Benedetto (Hamayl)
Laura (PSailormoon)
Gianluca Pavan(loziodm)
Stefania Meda(Stefanya66)
(LiberoEnri)
Patrizia Chiara (TempoYoga)
Miro (shining)
Umberto (Umberto)
Cinzia Cassandro(dollybonbon)
Luciana (travaluci)
Giulio Sassetti(giulsass)
Valeria Civardi(Vallicivardi57)
(Erica80)
Lorena (LoBa82)
Marco Ronzitti(Marco71CB)
Terry (Terry00025)
GiuliaAdele (Ilpontediluce)
Barbara (Gelsomina25)
(Monoinique)
Harry Tallarita(HarryTallarita)
Laurariel (parolainterna)
Marcos Cé(RaccoglitoriEclettici)
(Rosangela)
Robi (robertopigazzi)
Giovanni (Giovanni_1066)
Simona (sichilab)
(gianca1210)
Gloria (Smalll13)
Manuela (Magdaleine76)
(Arc_en_ciel_6)
Barbara (Stelle74)
Jessica BlackMagic(JesBMagic)
Claudio Taroppi(CriptoSophia)
Frank (Frankkk22F)
(Anette)
Emanuele (gemanuele)
Lara Canevese(LaraCanevese)
(Xeniasanvito)
Giuseppe (lupobranco)
Fabiana (fabiale69)
(NickyvanderLaan)
Diana (Diana_ddag)
(Denna4)
Atena (cascinaboccida)
(Diegopinna)
Paolo 8pax(Paolo8PAX)
Gianni (iugola72)
Letizia Gozzini(LetiziaFooFigthers64)
Giacomo Di Fabio(Giacomo_1979)
Franco (francomario)
Lisa Franceschini(Lisa83)
Carola (Carola)
(Fatinaalc)
(SuryaArena)
Ale (Florealefiore)
Alessandra (ale_5679)
Sonia (SoniaCri)
Federico (frixxx)
Anna (biapanna)
Mik (MikelaPi)
(Giovannifruttadisicilia)
Barbara Matteucci(BarbaraMatt)
Ariette (ArietteMorano)
Roberta Civirani (Robynlorien)
Marina (Norminiax)
Elisa Carbonetti(Nonnanena)
Marinella Galletti(marinella964)
Graziana Ungarelli(nonsiemaisoli)
Agnese Ferrari(Agny11)
Giovanna Simoni(Gio8marzo)
Marta (Martasel)
Luca Fraulini(FrauliniLuca)
Maria Valentina Bresciani(Valesolovale)
Onorio (Onorio69)
Cristina (tictac1972)
Cla (Clayoga77)
Massimo Cognome(mcomparin)
Marcola (Marcyfi)
(BarbaraMiz)
(TGuga)
MARCO COPPOLA(MarcoTullioAntonio)
Alessandra Barresi(Alessandra_Barresi)
Paola Tierri(Paola0503)
Gianluca Vannini(Cucca60)
Lorena Benigna(lorenabenigna)
(MF81B)
(maema67)
Miriam Notarangelo(LisandraFatina)
Giulietta Gnutti(Giu_733)
(SismaLux)
Francesca (francescalivorno)
(MarisaConti)
Ale Mare(AlesMare)
Anna Maria (accoglienzaa)
Sebastiano (pielento)
Stefano Giordano(Sankari9)
Leon (Umanolistico)
(Andrea_di_STATO_Calautti)
Calliope (Calliopesca)
Simona Turiano(simoNaturopata)
Paola (alaya562)
Andrea Sturniolo(yosoyvoz)
(albertinamarinelli)
Graziella (mammalella960)
(memorelax)
Francesca Marinelli(FrancescaM68)
Patrizia (PattyChiarissimi)
Marco Rastelli(marcorastelli)
Gianni Bianco(ireteditore)
(ClaudiaCalabria)
Filo (i7specchi)
(Charms64)
(Lore12345670)
Letizia 🌞 (Rissho_Ankoku_Ron)
(AnnitaSpinelli)
Franca Marin(FrancaM33)
(Micbo77)
(danieleduboin)
(IvanoBo81)
Patrizia Alvisi(Paciccia65)
Stefano Baratti(StefanoB)
(Sabrina_Monticelli)
Natascia (Natty_Natty71)
Riccardo Tonelli(crescerelaluce)
(ClaudioFa)
Grazia (GraziaGa)
Giorgio (giorgio_p75)
Massimo Trustee De Vita(Mcgiverbis)
Adriana (AfeWellmade)
(Ceramichedeby)
(Erby66)
Elena Trustee Marino(ALLEANZAdelDONO)
Luca (Lucavernicolo)
(LaraDea)
Marie V(massaiarurale)
Giuseppe Mercone(Enomerc82)
Giovanni Canu(gheo3)
Davide (Pippillino)
(Kia_10)
Leonardo (Leonardo2823)
Fabio (Cecefabene)
Paolo (PaUD70)
(Gnampolo)
franz (franz)
araceli de la parra(liladivineplay)
Mamo Bel(mamo_bel)
Rossella (MazzuRoss)
(Lellagab)
Enzo Fazzino(enzofazzino)
(Joska69)
Pamela (Pami74Veronza)
Iglis (Ziglis)
(Mirella64)
(carmen_bologna)
Emi (EmiEllis)
David Lendaro(dlend80)
(FeelGM)
Daniele Spina(Vincente7)
Gloria Camporesi(picipaci)
(Bibessa)
Ruben Antonio Vladilo(Ruben369)
Stefano Succi(Abbastanza_asociale)
Andrea (Falko2222)
Barbara (bosco2017)
(AntonyHopi)
(elsamoretto)
Michele Ceccarelli(michelececca)
Fabiana Nicoletti(Fabiananico)
(Canacaya)
(marziamoon)
Sara (SaraRiflePla)
Letizia Bergamini(Laetitia73)
Lucia Mistrali(LuciaMistrali)
(Rita_Lila)
Lidia (bjoyautenticipernatura)
Andrea (apasquali)
Laura (Lauratabs)
Noemi (NoemiJosephine)
Ombretta Cecchetti(OmbrettaCecchetti)
(MyGrace)
Sebastiano Parmegiani(ZSeba)
Simona (GiulioLunaLuce)
Sara (sarabaraldi23)
Mirca Forcellini(donnainevoluzione)
(ciccibicci3)
(Donpersival)
Alessia (CentrOlisticoShanti)
Robi G.(robig67)
Cristina (cristina_espo)
(Buc14)
(Paperlella)
Sergio Salutati(Sesarinos)
Arianna (Tricric)
(nikydeva)
(SoloMario)
Anna (Oona79)
Barbara (Barbie)
(ElisabettaTraficante)
Gabriele Daprai(Gabry75)
Massimo Costacurta(ilcosta54)
(Katia)
(isabellina1)
Riccardo (riccaudace)
(Gherarda24)
Antonio Sorbello(antoniosorbello)
Eric Souqi(GAMBERON3)
Fabio Ricci(Fabioricci74)
Daniela Stranieri(isolachenonce)
Roberto (turo951)
Laura (NOGIPPI)
Mer 24/04 ORE 20:44: APPARTIENE_CIRCUITO_RIS:
contasolo
Mer 24/04 ORE 20:44: 703 ✉️ Messaggi da Inviare
Mer 24/04 ORE 20:45: 🤖: Da Sùrya (Paolo) (paoloar77):
invia a paolo
Mer 24/04 ORE 20:45: 🤖: Da Sùrya (Paolo) (paoloar77):
📨 invia a paolo
Mer 24/04 ORE 20:46: PAOLO:
💚🍚 Cari membri dei Circuiti Ris,
quando siete entrati nel vostro circuito territoriale, avete dichiarato di avere letto e approvato il Regolamento di funzionamento dei Circuiti Ris.
📖 Leggi qui il Regolamento
Il gruppo dei Facilitatori Territoriali di RISO ha individuato un punto che necessita di chiarimenti, per rendere più esplicito un meccanismo già presente nel testo stesso. Propone dunque di aggiungere una nota esplicativa (vedi asterisco *) alla seguente frase del Regolamento (indicata in corsivo):
➡️ "… Ciascun detentore di un saldo negativo concorda che la sua esposizione funge da garanzia della quantità di Ris equivalenti circolanti nel circuito e che può essere chiamato a regolarizzare con equivalente pagamento in euro *, entro un lasso di tempo ragionevolmente adeguato, nel caso in cui: la Comunità, in accordo con il Gruppo Tecnico, deliberi il rientro di alcune posizioni con decisione motivata; lutente decida di uscire per motivi personali; il circuito chiuda, per decisione deliberata o per motivi di forza maggiore.”
✅ * La regolarizzazione può avvenire con equivalente valore in beni e servizi, oppure, in ultima istanza, con pagamento in euro.
📣 Invitiamo tutti a prendere visione della proposta, e ad esprimere eventuali osservazioni nel Gruppo Territoriale, oppure come commento a questo stesso post, pubblicato sul canale Progetto RISO, entro il giorno 5 maggio!
https://t.me/riso_canale/739
In attesa di riscontri, salutiamo! 🍚💚
Il gruppo dei Facilitatori Territoriali RISO
Mer 24/04 ORE 20:46: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 20:48: PAOLO:
PROVA GRASSETTO
Mer 24/04 ORE 20:48: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 20:58: 🤖: Da Sùrya (Paolo) (paoloar77):
grass e prova italic
Mer 24/04 ORE 21:11: PAOLO:
grass e prova italic
Mer 24/04 ORE 21:11: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 21:19: PAOLO:
grass e prova italic
Mer 24/04 ORE 21:19: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 21:32: PAOLO:
IMPORTANTE❗
💚🍚 Cari membri dei Circuiti Ris,
quando siete entrati nel vostro circuito territoriale, avete dichiarato di avere letto e approvato il Regolamento di funzionamento dei Circuiti Ris.
📖 Leggi qui il Regolamento
Il gruppo dei Facilitatori Territoriali di RISO ha individuato un punto che necessita di chiarimenti, per rendere più esplicito un meccanismo già presente nel testo stesso. Propone dunque di aggiungere una nota esplicativa (vedi asterisco *) alla seguente frase del Regolamento (indicata in corsivo):
➡️ "… Ciascun detentore di un saldo negativo concorda che la sua esposizione funge da garanzia della quantità di Ris equivalenti circolanti nel circuito e che può essere chiamato a regolarizzare con equivalente pagamento in euro *, entro un lasso di tempo ragionevolmente adeguato, nel caso in cui: la Comunità, in accordo con il Gruppo Tecnico, deliberi il rientro di alcune posizioni con decisione motivata; lutente decida di uscire per motivi personali; il circuito chiuda, per decisione deliberata o per motivi di forza maggiore.”
✅ * La regolarizzazione può avvenire con equivalente valore in beni e servizi, oppure, in ultima istanza, con pagamento in euro.
📣 Invitiamo tutti a prendere visione della proposta, e ad esprimere eventuali osservazioni nel Gruppo Territoriale, oppure come commento a questo stesso post, pubblicato sul canale Progetto RISO, entro il giorno 5 maggio!
https://t.me/riso_canale/739
In attesa di riscontri, salutiamo! 🍚💚
Il gruppo dei Facilitatori Territoriali RISO
Mer 24/04 ORE 21:32: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 21:35: PAOLO:
prova
Mer 24/04 ORE 21:35: 1 ✉️ Messaggi Inviati !
Mer 24/04 ORE 21:58: APPARTIENE_CIRCUITO_RIS:
SDADA
Mer 24/04 ORE 22:01: APPARTIENE_CIRCUITO_RIS:
IMPORTANTE❗
💚🍚 Cari membri dei Circuiti Ris,
quando siete entrati nel vostro circuito territoriale, avete dichiarato di avere letto e approvato il Regolamento di funzionamento dei Circuiti Ris.
📖 Leggi qui il Regolamento
Il gruppo dei Facilitatori Territoriali di RISO ha individuato un punto che necessita di chiarimenti, per rendere più esplicito un meccanismo già presente nel testo stesso. Propone dunque di aggiungere una nota esplicativa (vedi asterisco *) alla seguente frase del Regolamento (indicata in corsivo):
➡️ "… Ciascun detentore di un saldo negativo concorda che la sua esposizione funge da garanzia della quantità di Ris equivalenti circolanti nel circuito e che può essere chiamato a regolarizzare con equivalente pagamento in euro *, entro un lasso di tempo ragionevolmente adeguato, nel caso in cui: la Comunità, in accordo con il Gruppo Tecnico, deliberi il rientro di alcune posizioni con decisione motivata; lutente decida di uscire per motivi personali; il circuito chiuda, per decisione deliberata o per motivi di forza maggiore.”
✅ * La regolarizzazione può avvenire con equivalente valore in beni e servizi, oppure, in ultima istanza, con pagamento in euro.
📣 Invitiamo tutti a prendere visione della proposta, e ad esprimere eventuali osservazioni nel Gruppo Territoriale, oppure come commento a questo stesso post, pubblicato sul canale Progetto RISO, entro il giorno 5 maggio!
https://t.me/riso_canale/739
In attesa di riscontri, salutiamo! 🍚💚
Il gruppo dei Facilitatori Territoriali RISO
Mer 24/04 ORE 22:02: 🤖: Da Sùrya (Paolo) (paoloar77):
✅ la regolarizzazione può avv

View File

@@ -96,4 +96,104 @@ PaoTEST1: 10 RIS]
Gio 12/10 ORE 08:06: [<b>Circuito RIS Rimini</b>]: Inviate Monete da paoloar77 a SuryaArena2 1 RIS [causale: ] Gio 12/10 ORE 08:06: [<b>Circuito RIS Rimini</b>]: Inviate Monete da paoloar77 a SuryaArena2 1 RIS [causale: ]
Saldi: Saldi:
paoloar77: -18 RIS] paoloar77: -18 RIS]
SuryaArena2: 7 RIS] SuryaArena2: 7 RIS]
Mer 29/11 ORE 16:35: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 5 RIS [causale: Seconda]
Saldi:
SuryaArena: -5 RIS]
paoloar77: 5 RIS]
Mer 29/11 ORE 16:44: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 3 RIS [causale: Eccolo]
Saldi:
SuryaArena: -8 RIS]
paoloar77: 8 RIS]
Mer 29/11 ORE 16:50: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 3 RIS [causale: Ricevuto un bel massaggio]
Saldi:
SuryaArena: -11 RIS]
paoloar77: 11 RIS]
Mer 29/11 ORE 16:52: [<b>Circuito RIS Bologna</b>]: Inviate Monete da SuryaArena a paoloar77 4 RIS [causale: Un bel massaggio con olio caldo]
Saldi:
SuryaArena: -4 RIS]
paoloar77: 14 RIS]
Mer 29/11 ORE 17:14: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 2 RIS [causale: Massaggio !]
Saldi:
SuryaArena: -13 RIS]
paoloar77: 13 RIS]
Gio 04/01 ORE 14:00: [<b>Euro</b>]: Inviate Monete da PaoloRiso a piuchebuono 44.4 € [causale: Pagato Ordine n.101]
Saldi:
PaoloRiso: -44.4 €]
piuchebuono: 44.4 €]
Dom 07/01 ORE 16:22: [<b>Euro</b>]: Inviate Monete da PaoloRiso a 44.4 € [causale: Pagato Ordine n.101]
Saldi:
PaoloRiso: -44.4 €]
: 44.4 €]
Dom 07/01 ORE 16:24: [<b>Euro</b>]: Inviate Monete da PaoloRiso a 44.4 € [causale: Pagato Ordine n.101]
Saldi:
PaoloRiso: -88.8 €]
: 88.8 €]
Ven 16/02 ORE 13:51: [<b>Euro</b>]: Inviate Monete da PaoloRiso a piuchebuono 9.6 € [causale: Pagato Ordine n.169]
Saldi:
PaoloRiso: -98 €]
piuchebuono: 1109.1799999999998 €]
Ven 16/02 ORE 13:57: [<b>Euro</b>]: Inviate Monete da Barbara a piuchebuono 15.6 € [causale: Pagato Ordine n.171]
Saldi:
Barbara: -61.2 €]
piuchebuono: 1124.7799999999997 €]
Ven 16/02 ORE 14:05: [<b>Euro</b>]: Inviate Monete da Loabati a piuchebuono 6 € [causale: Pagato Ordine n.174]
Saldi:
Loabati: -24.6 €]
piuchebuono: 1130.7799999999997 €]
Sab 17/02 ORE 14:04: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 5 RIS [causale: ]
Saldi:
paoloar77: 31 RIS]
SuryaArena: 5 RIS]
Sab 17/02 ORE 14:10: [<b>Circuito RIS Bologna</b>]: Inviate Monete da SuryaArena a paoloar77 4 RIS [causale: Per Paolo]
Saldi:
SuryaArena: 1 RIS]
paoloar77: 35 RIS]
Sab 17/02 ORE 14:11: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 6 RIS [causale: Per Surya]
Saldi:
paoloar77: 29 RIS]
SuryaArena: 7 RIS]
Sab 17/02 ORE 14:50: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 3 RIS [causale: BBBBAAA]
Saldi:
paoloar77: 26 RIS]
SuryaArena: 10 RIS]
Sab 17/02 ORE 14:53: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 4 RIS [causale: GGGG]
Saldi:
paoloar77: 22 RIS]
SuryaArena: 14 RIS]
Sab 17/02 ORE 15:03: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 2 RIS [causale: ]
Saldi:
paoloar77: 20 RIS]
SuryaArena: 16 RIS]
Gio 11/04 ORE 16:54: [<b>Euro</b>]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.236]
Saldi:
paoloar77: -246.8 €]
piuchebuono: 2181.0999999999985 €]
Gio 11/04 ORE 16:55: [<b>Euro</b>]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.235]
Saldi:
paoloar77: -356.8 €]
piuchebuono: 2291.0999999999985 €]
Gio 11/04 ORE 16:57: [<b>Euro</b>]: Inviate Monete da paoloar77 a piuchebuono 110 € [causale: Pagato Ordine n.234]
Saldi:
paoloar77: -466.8 €]
piuchebuono: 2401.0999999999985 €]
Gio 25/04 ORE 11:43: [<b>Circuito RIS Bologna</b>]: Inviate Monete da SuryaArena a paoloar77 1 RIS [causale: ]
Saldi:
SuryaArena: -1 RIS]
paoloar77: 38 RIS]
Gio 25/04 ORE 14:37: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a SuryaArena 38 RIS [causale: ]
Saldi:
paoloar77: 0 RIS]
SuryaArena: 37 RIS]
Gio 09/05 ORE 17:27: [<b>Circuito RIS Catania</b>]: Inviate Monete da paoloar77 a Giovannifruttadisicilia 1.5 RIS [causale: prova]
Saldi:
paoloar77: -1.50 RIS]
Giovannifruttadisicilia: 1.50 RIS]
Mar 28/05 ORE 16:51: [<b>Circuito RIS Italia</b>]: Inviate Monete da ElenaEspx a Giovannifruttadisicilia 14 RIS [causale: Acquisto arance 30genn24 RisoBologna 2]
Saldi:
ElenaEspx: -32.10 RIS]
Giovannifruttadisicilia: 222.50 RIS]
Mar 28/05 ORE 16:51: [<b>Circuito RIS Italia</b>]: Inviate Monete da ElenaEspx a Giovannifruttadisicilia 28 RIS [causale: Acquisto arance 30genn24 RisoBologna 1]
Saldi:
ElenaEspx: -60.10 RIS]
Giovannifruttadisicilia: 250.50 RIS]

47
outout.csv Normal file
View File

@@ -0,0 +1,47 @@
Num|Nome|Peso|Prezzo|Quantita|Totale|Ordini
0|"Acqua distillata di rose di Damasco"|100|8|2|16|1
0|"Artemisia in foglie"|20|1,5|7|10,5|3
0|"Cannella"|100|3|4|12|3
0|"Carruba macinata"|250|3|2|6|2
0|"Cous cous 5 stelle (grano duro, mais, orzo, lenticchie ed avena)"|500|3,5|1|3,5|1
0|"Cous cous d'avena"|500|3|3|9|2
0|"Cous cous d'orzo"|500|3|1|3|1
0|"Cous cous di grano duro (Akka)"|500|3,25|1|3,25|1
0|"Cous cous di lenticchie"|500|3,5|4|14|3
0|"Cous cous di miglio"|500|3|4|12|4
0|"Couscous 5 cereali 1kg"|1|5,5|1|5,5|1
0|"Couscous di grano duro 500g"|500|2,5|1|2,5|1
0|"Curcuma"|100|3|5|15|4
0|"Datteri boufeggous extra 1kg"|1|11|1|11|1
0|"Datteri boufeggous extra 500g"|500|6,5|3|19,5|3
0|"Datteri boustahammi 1kg"|1|5|11|55|6
0|"Datteri boustahammi 500g"|500|3|3|9|3
0|"Datteri bouzagagh 1kg"|1|5,5|2|11|2
0|"Datteri bouzagagh 500g"|500|3,5|7|24,5|6
0|"Farina di segale grigliata 1kg"|1|3,5|1|3,5|1
0|"Fichi secchi bianchi 250g"|250|5|1|5|1
0|"Fichi secchi bianchi 500g"|500|9|1|9|1
0|"Fieno greco"|500|3,5|2|7|1
0|"Ghassoul (pezzetti di argilla saponifera) per capelli"|100|4|2|8|2
0|"Henné"|250|3|2|6|2
0|"Henné (per tatuaggi e capelli)"|200|3,5|1|3,5|1
0|"Henné (per tatuaggi e capelli)"|150|2,5|1|2,5|1
0|"Menta Maachi (autoctona) in foglie"|20|1,5|1|1,5|1
0|"Olio alle rose di Damasco"|60|9|2|18|2
0|"Olio di argan cosmetico 30ml"|30|8|3|24|2
0|"Olio di mandorle dolci"|30|5,5|1|5,5|1
0|"Olio di nigella (cumino nero)"|30|5,5|1|5,5|1
0|"Olio di sesamo"|30|5,5|1|5,5|1
0|"Olive nere"|125|2|1|2|1
0|"Olive nere alle piante aromatiche 1kg"|1|9|1|9|1
0|"Olive nere alle piante aromatiche 500g"|500|5|1|5|1
0|"Olive verdi alle piante aromatiche 1kg"|1|9|1|9|1
0|"Olive verdi alle spezie 500g"|500|5|1|5|1
0|"Paprika dolce senza olio"|100|3|2|6|2
0|"Prugne secche"|250|3|2|6|2
0|"Rose secche di Damasco"|50|2,5|2|5|2
0|"Sapone a base di olio di argan"|80|4|3|12|3
0|"Scrub Naama (rosa, in polvere)"|100|5|2|10|2
0|"Sottopentola medio"|296|2,5|1|2,5|1
0|"Verbena citronella in foglie"|20|1,5|1|1,5|1
0|"Zenzero"|100|3|2|6|2
1 Num Nome Peso Prezzo Quantita Totale Ordini
2 0 Acqua distillata di rose di Damasco 100 8 2 16 1
3 0 Artemisia in foglie 20 1,5 7 10,5 3
4 0 Cannella 100 3 4 12 3
5 0 Carruba macinata 250 3 2 6 2
6 0 Cous cous 5 stelle (grano duro, mais, orzo, lenticchie ed avena) 500 3,5 1 3,5 1
7 0 Cous cous d'avena 500 3 3 9 2
8 0 Cous cous d'orzo 500 3 1 3 1
9 0 Cous cous di grano duro (Akka) 500 3,25 1 3,25 1
10 0 Cous cous di lenticchie 500 3,5 4 14 3
11 0 Cous cous di miglio 500 3 4 12 4
12 0 Couscous 5 cereali 1kg 1 5,5 1 5,5 1
13 0 Couscous di grano duro 500g 500 2,5 1 2,5 1
14 0 Curcuma 100 3 5 15 4
15 0 Datteri boufeggous extra 1kg 1 11 1 11 1
16 0 Datteri boufeggous extra 500g 500 6,5 3 19,5 3
17 0 Datteri boustahammi 1kg 1 5 11 55 6
18 0 Datteri boustahammi 500g 500 3 3 9 3
19 0 Datteri bouzagagh 1kg 1 5,5 2 11 2
20 0 Datteri bouzagagh 500g 500 3,5 7 24,5 6
21 0 Farina di segale grigliata 1kg 1 3,5 1 3,5 1
22 0 Fichi secchi bianchi 250g 250 5 1 5 1
23 0 Fichi secchi bianchi 500g 500 9 1 9 1
24 0 Fieno greco 500 3,5 2 7 1
25 0 Ghassoul (pezzetti di argilla saponifera) per capelli 100 4 2 8 2
26 0 Henné 250 3 2 6 2
27 0 Henné (per tatuaggi e capelli) 200 3,5 1 3,5 1
28 0 Henné (per tatuaggi e capelli) 150 2,5 1 2,5 1
29 0 Menta Maachi (autoctona) in foglie 20 1,5 1 1,5 1
30 0 Olio alle rose di Damasco 60 9 2 18 2
31 0 Olio di argan cosmetico 30ml 30 8 3 24 2
32 0 Olio di mandorle dolci 30 5,5 1 5,5 1
33 0 Olio di nigella (cumino nero) 30 5,5 1 5,5 1
34 0 Olio di sesamo 30 5,5 1 5,5 1
35 0 Olive nere 125 2 1 2 1
36 0 Olive nere alle piante aromatiche 1kg 1 9 1 9 1
37 0 Olive nere alle piante aromatiche 500g 500 5 1 5 1
38 0 Olive verdi alle piante aromatiche 1kg 1 9 1 9 1
39 0 Olive verdi alle spezie 500g 500 5 1 5 1
40 0 Paprika dolce senza olio 100 3 2 6 2
41 0 Prugne secche 250 3 2 6 2
42 0 Rose secche di Damasco 50 2,5 2 5 2
43 0 Sapone a base di olio di argan 80 4 3 12 3
44 0 Scrub Naama (rosa, in polvere) 100 5 2 10 2
45 0 Sottopentola medio 296 2,5 1 2,5 1
46 0 Verbena citronella in foglie 20 1,5 1 1,5 1
47 0 Zenzero 100 3 2 6 2

View File

@@ -14,7 +14,7 @@
"test-watch": "nodemon --exec 'npm test'" "test-watch": "nodemon --exec 'npm test'"
}, },
"engines": { "engines": {
"node": "^16.19.0" "node": "^18.19.0"
}, },
"author": "Paolo Arena", "author": "Paolo Arena",
"license": "MIT", "license": "MIT",
@@ -37,6 +37,7 @@
"image-downloader": "^4.3.0", "image-downloader": "^4.3.0",
"internet-available": "^1.0.0", "internet-available": "^1.0.0",
"jade": "^1.9.2", "jade": "^1.9.2",
"jsdom": "^24.0.0",
"jsonwebtoken": "^9.0.1", "jsonwebtoken": "^9.0.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mongodb": "^4.4.1", "mongodb": "^4.4.1",
@@ -46,19 +47,21 @@
"node-emoji": "^1.11.0", "node-emoji": "^1.11.0",
"node-image-resizer": "^1.0.0", "node-image-resizer": "^1.0.0",
"node-pre-gyp": "^0.14.0", "node-pre-gyp": "^0.14.0",
"node-telegram-bot-api": "^0.59.0", "node-telegram-bot-api": "^0.65.1",
"nodemailer": "^6.7.8", "nodemailer": "^6.7.8",
"npm-check-updates": "^16.1.0", "npm-check-updates": "^16.14.18",
"pem": "^1.14.6", "pem": "^1.14.6",
"preview-email": "^3.0.7", "preview-email": "^3.0.7",
"pug": "^3.0.2", "pug": "^3.0.2",
"rate-limiter-flexible": "^2.3.9", "rate-limiter-flexible": "^2.3.9",
"request": "^2.34",
"sanitize-html": "^2.13.0",
"save": "^2.5.0", "save": "^2.5.0",
"sharp": "^0.30.7", "sharp": "^0.30.7",
"superagent": "^8.0.0", "superagent": "^8.0.0",
"url-parse": "^1.5.10", "url-parse": "^1.5.10",
"validator": "^13.7.0", "validator": "^13.7.0",
"web-push": "^3.5.0", "web-push": "^3.6.7",
"xoauth2": "^1.2.0" "xoauth2": "^1.2.0"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -2,7 +2,7 @@
body, #body_style { body, #body_style {
margin: 0; margin: 0;
padding: 0; padding: 0;
background: #E9F2F9; background: #E9F2F9 !important;
color: #5b656e; color: #5b656e;
} }

View File

@@ -10,12 +10,13 @@ var file = `.env.${node_env}`;
// GLOBALI (Uguali per TUTTI) // GLOBALI (Uguali per TUTTI)
process.env.LINKVERIF_REG = '/vreg'; process.env.LINKVERIF_REG = '/vreg';
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd'; process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
process.env.ADD_NEW_SITE = '/addNewSite';
process.env.LINK_UPDATE_PASSWORD = '/updatepassword'; process.env.LINK_UPDATE_PASSWORD = '/updatepassword';
process.env.LINK_UPDATE_PWD = '/updatepwd'; process.env.LINK_UPDATE_PWD = '/updatepwd';
process.env.LINK_CHECK_UPDATES = '/checkupdates'; process.env.LINK_CHECK_UPDATES = '/checkupdates';
process.env.KEY_APP_ID = 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF'; process.env.KEY_APP_ID = 'KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF';
// console.log("Starting Node with : " + file); console.log("Starting Node with: " + file);
require('dotenv').config({ path: file }); require('dotenv').config({ path: file });
process.env.DATABASE = process.env.DATABASE || 'FreePlanet'; process.env.DATABASE = process.env.DATABASE || 'FreePlanet';

View File

@@ -11,7 +11,7 @@ mongoose.plugin(schema => {
mongoose.set('debug', false); mongoose.set('debug', false);
const options = { let options = {
// user: process.env.UDB, // user: process.env.UDB,
// pass: process.env.PDB, // pass: process.env.PDB,
// useMongoClient: true, // useMongoClient: true,
@@ -38,22 +38,38 @@ const options = {
// keepAliveInitialDelay: 300000 // keepAliveInitialDelay is the number of milliseconds to wait before initiating keepAlive on the socket. // keepAliveInitialDelay: 300000 // keepAliveInitialDelay is the number of milliseconds to wait before initiating keepAlive on the socket.
}; };
console.log('process.env.AUTH_MONGODB', process.env.AUTH_MONGODB);
if (process.env.AUTH_MONGODB === '1') {
options.auth = {
authSource: "admin",
poolSize: 10,
user: process.env.MONGODB_USER,
password: process.env.MONGODB_PWD,
};
}
if (options.auth && options.auth.user) {
console.log('MongoDb con Authenticazione:', options.auth.user, '******');
} else {
console.log('### MongoDb SENZA Authenticazione !!! ');
}
const db = mongoose.connection; const db = mongoose.connection;
// mongoose.connect(process.env.MONGODB_URI + '?authSource=admin', { options })
// console.log(' -> PASSAGGIO PARAMETRI MONGOOSE')
console.log('Node Version ' + process.version); console.log('Node Version ' + process.version);
console.log('Mongoose Version ' + mongoose.version); console.log('Mongoose Version ' + mongoose.version);
console.log('Connessione a ' + process.env.MONGODB_URI + ' in corso...');
mongoose.connect(process.env.MONGODB_URI, options); connectionUrl = process.env.MONGODB_URI;
console.log('Connessione a ' + connectionUrl + ' in corso...');
mongoose.connect(connectionUrl, options);
db.on('error', console.error.bind(console, 'connection error:')); db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() { db.once('open', function () {
// we're connected! // we're connected!
console.log('*** CONNESSIONE EFFETTUATA ! ' + process.env.MONGODB_URI + ' db: ' + process.env.DATABASE) console.log('*** CONNESSIONE EFFETTUATA ! ' + connectionUrl + ' db: ' + process.env.DATABASE)
}); });
module.exports = {mongoose}; module.exports = { mongoose };

View File

@@ -1,6 +1,9 @@
{ {
"Hello": "Ciao", "Hello": "Ciao",
"Hello %s": "Ciao %s", "Hello %s": "Ciao %s",
"Good": "Bene",
"Service": "Servizio",
"Hosp": "Ospitalità",
"Good: %s": "Bene: %s", "Good: %s": "Bene: %s",
"Service: %s": "Servizio: %s", "Service: %s": "Servizio: %s",
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>", "NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>",
@@ -8,7 +11,9 @@
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>", "NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>",
"NEW_EVENT": "❇️ <strong>%s</strong> ha aggiunto un nuovo Evento: \n%s\n<strong>%s</strong>\n%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_EVENT_TELEGRAM": "%s\n\n❇ <strong>%s</strong>\n\n%s\n\n%s",
"ADDED_FROM": "\n\n<i>(Evento aggiunto da <strong>%s</strong>)</i>", "NEW_ANNUNCIO_TELEGRAM": "❇️ <strong>%s</strong>\n\n%s\n\n%s",
"EVENT_ADDED_FROM": "\n\n<i>(Evento aggiunto da <strong>%s</strong>)</i>",
"ADDED_FROM": "\n\n<i>(Aggiunto da <strong>%s</strong>)</i>",
"CONTRIB": "\n💠 Contributo richiesto: %s", "CONTRIB": "\n💠 Contributo richiesto: %s",
"ORGANIZED_BY": "\n<i>Organizzato da <strong>%s</strong></i>", "ORGANIZED_BY": "\n<i>Organizzato da <strong>%s</strong></i>",
"SHOW_POST": "👉🏻 vedi post su RISO", "SHOW_POST": "👉🏻 vedi post su RISO",
@@ -18,9 +23,10 @@
"<strong>%s</strong> refused your Friendship": "<strong>%s</strong> ha rifiutato l'Amicizia", "<strong>%s</strong> refused your Friendship": "<strong>%s</strong> ha rifiutato l'Amicizia",
"✅ %s accepted your Friendship request !": "✅ %s ha accettato la tua richiesta di Amicizia !", "✅ %s accepted your Friendship request !": "✅ %s ha accettato la tua richiesta di Amicizia !",
"✅ You have accepted %s' Friendship request!": "✅ Hai accettato la richiesta di Amicizia di %s !", "✅ You have accepted %s' Friendship request!": "✅ Hai accettato la richiesta di Amicizia di %s !",
"HANDSHAKE_SET": "<strong>%s</strong> ha comunicato che ti conosce personalmente e ha fiducia in te.", "HANDSHAKE_SET": "<strong>%s</strong> ha comunicato che ti conosce personalmente e ha Fiducia in te (Stretta di mano).",
"HANDSHAKE_CONFIRMED": "🤝 Hai contraccambiato la fiducia in <strong>%s</strong>!", "HANDSHAKE_SENT_FROM_YOU": "🤝 hai inviato una Stretta di Mano a <strong>%s</strong>, perché la conosci personalmente !",
"HANDSHAKE_ACCEPTED": "🤝 <strong>%s</strong> ha contraccambiato la stretta di mano (fiducia) !", "HANDSHAKE_CONFIRMED": "🤝 Hai contraccambiato la stretta di mano di <strong>%s</strong>!",
"HANDSHAKE_ACCEPTED": "🤝 <strong>%s</strong> ha contraccambiato la tua stretta di mano !",
"GROUPS_ACCEPTED": "✅ Sei stato accettato a far parte del Gruppo %s (da parte di %s)", "GROUPS_ACCEPTED": "✅ Sei stato accettato a far parte del Gruppo %s (da parte di %s)",
"GROUPS_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del Gruppo %s. Se pensi sia un'errore, contatta l'amministratore del Gruppo.", "GROUPS_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del Gruppo %s. Se pensi sia un'errore, contatta l'amministratore del Gruppo.",
"GROUPS_REMOVED": "❌ l'utente %s è stato rimosso del Gruppo %s (da parte di %s)", "GROUPS_REMOVED": "❌ l'utente %s è stato rimosso del Gruppo %s (da parte di %s)",
@@ -43,10 +49,10 @@
"FRIEND_UNBLOCKED_TO_ME": "Sei stato riattivato da %s", "FRIEND_UNBLOCKED_TO_ME": "Sei stato riattivato da %s",
"FRIEND_UNBLOCKED": "E' stato riattivato %s da %s.", "FRIEND_UNBLOCKED": "E' stato riattivato %s da %s.",
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.", "FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍‍♂️ Abilita fido a %s nel '%s':", "CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍‍♂️ Abilita Fiducia a %s nel '%s':",
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍‍♂️ Abilita fido nel Circuito al gruppo %s:", "CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍‍♂️ Abilita Fiducia nel Circuito al gruppo %s:",
"CIRCUIT_OPEN_RISITALIA": "Apri il Circuito RIS Italia e chiedi di entrare", "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 al Fido (è stato invitato da %s)", "CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s (con %s iscritti) ed è in attesa di essere abilitato alla Fiducia\n🙎🏻 Invitato da %s",
"CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s", "CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s",
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %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_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s (con %s iscritti)",
@@ -58,12 +64,12 @@
"CIRCUIT_REMOVED_ADMIN_YOU": "%s ti è stato rimosso l'incarico di Amministratore 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", "RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il %s da parte di %s",
"CIRCUIT_ELIMINATO": "Il %s è stato eliminato da parte di %s", "CIRCUIT_ELIMINATO": "Il %s è stato eliminato da parte di %s",
"FIDO_IMPOSTATO_ADMINS_CIRCUIT": "✅ l'utente %s è stato abilitato al Fido (%s RIS) sul '%s' (da parte di %s)", "FIDO_IMPOSTATO_ADMINS_CIRCUIT": "✅ l'utente %s è stato abilitato alla Fiducia (%s RIS) sul '%s' (da parte di %s)",
"FIDO_IMPOSTATO_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto di Gruppo %s è stato abilitato al Fido fino a -%s sul '%s' (da parte di %s)", "FIDO_IMPOSTATO_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto di Gruppo %s è stato abilitato alla Fiducia fino a -%s sul '%s' (da parte di %s)",
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT": "✅ l'utente %s è stato accettato a far parte del '%s' (da parte di %s)", "ACCETTATO_NOTIFICA_ADMINS_CIRCUIT": "✅ l'utente %s è stato accettato a far parte del '%s' (da parte di %s)",
"ACCETTATO_NOTIFICA_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto di Gruppo %s è stato accettato a far parte del '%s' (da parte di %s)", "ACCETTATO_NOTIFICA_ADMINS_CIRCUIT_MYGROUP": "✅ il Conto di Gruppo %s è stato accettato a far parte del '%s' (da parte di %s)",
"CIRCUIT_ACCEPTED": "✅ Sei stato accettato da %s a far parte del %s.\nApri la APP e clicca in alto a destra sull'icona delle monete, oppure clicca qui: %s", "CIRCUIT_ACCEPTED": "✅ Sei stato accettato da %s a far parte del %s.\nApri la APP e clicca in alto a destra sull'icona delle monete, oppure clicca qui: %s",
"FIDO_IMPOSTATO": "✅ Ti è stata attivata la possibilità di utilizzare il fido (Fiducia Concessa) fino a %s RIS da %s sul '%s'.", "FIDO_IMPOSTATO": "✅ Ti è stata attivata la possibilità di utilizzare la Fiducia Concessa fino a %s RIS da %s sul '%s'.",
"CIRCUIT_ACCEPTED_YOU": "✅ Hai accettato %s a far parte del '%s'", "CIRCUIT_ACCEPTED_YOU": "✅ Hai accettato %s a far parte del '%s'",
"CIRCUIT_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del '%s'. Se pensi sia un'errore, contatta l'amministratore del Circuito.", "CIRCUIT_REFUSED": "❌ Ti è stato rifiutato l'accesso da %s a far parte del '%s'. Se pensi sia un'errore, contatta l'amministratore del Circuito.",
"CIRCUIT_REMOVED": "❌ l'utente %s è stato rimosso del %s (da parte di %s)", "CIRCUIT_REMOVED": "❌ l'utente %s è stato rimosso del %s (da parte di %s)",
@@ -72,7 +78,7 @@
"CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal '%s'", "CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal '%s'",
"CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal '%s'", "CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal '%s'",
"CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal '%s' (da parte di %s)", "CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal '%s' (da parte di %s)",
"CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong> sul '%s'.", "CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong> sul <strong>'%s'</strong>",
"COMUNITARIO": "Comunitario", "COMUNITARIO": "Comunitario",
"COLLETTIVO": "Gruppo", "COLLETTIVO": "Gruppo",
"CIRCUIT_SENDCOINSREQ_GROUP": "%s sta inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.", "CIRCUIT_SENDCOINSREQ_GROUP": "%s sta inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.",
@@ -97,7 +103,7 @@
"STATUS_SENT": "Inviato", "STATUS_SENT": "Inviato",
"STATUS_REFUSED": "Rifiutato", "STATUS_REFUSED": "Rifiutato",
"SALDO_VARIATO": "[%s] l'utente %s ha variato il Saldo di %s da %s a %s %s", "SALDO_VARIATO": "[%s] l'utente %s ha variato il Saldo di %s da %s a %s %s",
"FIDOCONCESSO_VARIATO": "[%s] l'utente %s ha variato il Fido Concesso di %s da %s a %s %s", "FIDOCONCESSO_VARIATO": "[%s] l'utente %s ha variato la Fiducia Concessa di %s da %s a %s %s",
"QTAMAX_VARIATO": "[%s] l'utente %s ha variato la quantità massima concessa di %s da %s a %s %s", "QTAMAX_VARIATO": "[%s] l'utente %s ha variato la quantità massima concessa di %s da %s a %s %s",
"SET_FAVORITE": "%s ha messo 'Mi Piace' al tuo post: %s", "SET_FAVORITE": "%s ha messo 'Mi Piace' al tuo post: %s",
"SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s", "SET_FAVORITE_OTHERS": "%s e altre %s persone hanno messo 'Mi Piace' al tuo post: %s",
@@ -107,5 +113,11 @@
"DATEDAYONLY": "%s dalle %s alle %s", "DATEDAYONLY": "%s dalle %s alle %s",
"DATE_2DAYS": "%s dalle %s fino a %s alle %s", "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>.", "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" "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!",
"🚫 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 !"
}

View File

@@ -13,6 +13,7 @@ const auth_default = (req, res, next) => {
const authenticate = (req, res, next) => { const authenticate = (req, res, next) => {
const token = req.header('x-auth'); const token = req.header('x-auth');
//const refreshToken = req.header('x-refrtok');
// console.log('authenticate... '); // console.log('authenticate... ');
@@ -29,65 +30,80 @@ const authenticate = (req, res, next) => {
const access = 'auth'; const access = 'auth';
User.findByToken(token, access).then((user) => { return User.findByToken(token, access, true).then((ris) => {
if (!user) { if (ris && ris.user && !!ris.user.deleted) {
// tools.mylog("TOKEN " + token); if (ris.user.deleted)
// tools.mylog(" NOT FOUND! (Maybe Connected to other Page) ACCESS: '" + access + "'"); ris.user = null;
return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN);
// res.status().send();
} }
if (!!user.deleted) { if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
if (user.deleted) return Promise.reject(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED);
user = null;
} }
if (!user) { if (!ris.user) {
return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN); return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN);
} }
if (!!user) { if (!!ris.user) {
// Save last time online // Save last time online
user.lasttimeonline = new Date(); ris.user.lasttimeonline = new Date();
user.useragent = req.get('User-Agent'); ris.user.retry_pwd = 0
ris.user.useragent = req.get('User-Agent');
return user.save().then(() => { return ris.user.save().then(() => {
req.user = user; req.user = ris.user;
req.token = token; req.token = token;
// req.refreshToken = refreshToken;
req.access = access; req.access = access;
next(); next(); // Esegui il codice successivo
}); });
} }
// tools.mylog('userid', user._id); // tools.mylog('userid', user._id);
}).catch((e) => { }).catch((e) => {
if (e === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
}
tools.mylog("ERR authenticate invalid Token =", e); tools.mylog("ERR authenticate invalid Token =", e);
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send(); res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
}); });
}; };
const authenticate_noerror = (req, res, next) => { const authenticate_noerror = (req, res, next) => {
const token = req.header('x-auth'); try {
const token = req.header('x-auth');
const refreshToken = req.header('x-refrtok');
const access = 'auth'; const access = 'auth';
User.findByToken(token, access).then((user) => { return User.findByToken(token, access, false).then((ris) => {
if (!user) { if (ris.code !== server_constants.RIS_CODE_OK) {
req.user = null;
req.token = null;
req.access = null;
req.code = ris.code;
} else {
req.user = ris.user;
req.token = token;
req.refreshToken = refreshToken;
req.access = access;
req.code = ris.code;
}
// Vai avanti ad eseguire il codice, in ogni modo !
next();
}).catch((e) => {
req.user = null; req.user = null;
req.token = null; req.token = null;
req.access = null; req.access = null;
} else { req.code = 0;
req.user = user;
req.token = token; // Continua comunque !
req.access = access; next();
} });
next(); } catch (e) {
}).catch((e) => { console.error('Err', e);
req.user = null; }
req.token = null;
req.access = null;
});
}; };
module.exports = { authenticate, authenticate_noerror, auth_default }; module.exports = { authenticate, authenticate_noerror, auth_default };

View File

@@ -30,6 +30,9 @@ const AccountSchema = new Schema({
idapp: { idapp: {
type: String, type: String,
}, },
numtransactions: {
type: Number,
},
username: { username: {
type: String, type: String,
}, },
@@ -232,10 +235,16 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
myaccount.totTransato = 0; myaccount.totTransato = 0;
} }
myaccount.totTransato += Math.abs(amount); myaccount.totTransato += Math.abs(amount);
if (!myaccount.numtransactions)
myaccount.numtransactions = 0;
myaccount.numtransactions++;
myaccount.date_updated = new Date(); myaccount.date_updated = new Date();
myaccountupdate.saldo = myaccount.saldo; myaccountupdate.saldo = myaccount.saldo;
myaccountupdate.totTransato = myaccount.totTransato; myaccountupdate.totTransato = myaccount.totTransato;
myaccountupdate.numtransactions = myaccount.numtransactions;
myaccountupdate.date_updated = myaccount.date_updated; myaccountupdate.date_updated = myaccount.date_updated;
const ris = await Account.updateOne({ _id: myaccount.id }, const ris = await Account.updateOne({ _id: myaccount.id },
@@ -243,8 +252,8 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
$set: myaccountupdate $set: myaccountupdate
}); });
// Calcola Saldo Pendente !
await myaccount.calcPending(mitt); await myaccount.calcPending(true);
return ris; return ris;
@@ -272,8 +281,8 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
const { Circuit } = require('../models/circuit'); const { Circuit } = require('../models/circuit');
if (username === undefined) // if (username === undefined)
return false; // return false;
let myquery = { let myquery = {
idapp, idapp,
@@ -308,6 +317,7 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
fidoConcesso: 0, fidoConcesso: 0,
qta_maxConcessa: 0, qta_maxConcessa: 0,
totTransato: 0, totTransato: 0,
numtransactions: 0,
totTransato_pend: 0, totTransato_pend: 0,
}); });
@@ -636,7 +646,7 @@ AccountSchema.statics.updateQtaMax = async function (idapp, username, groupname,
else else
risult = await Account.updateOne({ idapp, username, circuitId }, { $set: paramstoupdate }); risult = await Account.updateOne({ idapp, username, circuitId }, { $set: paramstoupdate });
return risult; return risult && risult.nModified > 0;
}; };
AccountSchema.statics.getAccountsCircuitiNazionali = async function (idapp) { AccountSchema.statics.getAccountsCircuitiNazionali = async function (idapp) {
@@ -725,9 +735,8 @@ AccountSchema.statics.removeAdminOfAccount = async function (idapp, username, ci
// Rimuovi l'account // Rimuovi l'account
AccountSchema.statics.removeAccount = async function (accountId) { AccountSchema.statics.removeAccount = async function (accountId) {
const { Circuit } = require('../models/circuit');
return await Circuit.deleteOne({ _id: accountId}); return await Account.deleteOne({ _id: accountId});
}; };
AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) { AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) {
@@ -742,4 +751,8 @@ AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp
const Account = mongoose.model('Account', AccountSchema); const Account = mongoose.model('Account', AccountSchema);
Account.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Account }; module.exports = { Account };

View File

@@ -64,4 +64,8 @@ AdTypeSchema.statics.executeQueryTable = function(idapp, params) {
const AdType = mongoose.model('AdType', AdTypeSchema); const AdType = mongoose.model('AdType', AdTypeSchema);
AdType.createIndexes((err) => {
if (err) throw err;
});
module.exports = {AdType}; module.exports = {AdType};

View File

@@ -64,4 +64,8 @@ AdTypeGoodSchema.statics.executeQueryTable = function(idapp, params) {
const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema); const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema);
AdTypeGood.createIndexes((err) => {
if (err) throw err;
});
module.exports = {AdTypeGood}; module.exports = {AdTypeGood};

54
src/server/models/author.js Executable file
View File

@@ -0,0 +1,54 @@
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 AuthorSchema = new Schema({
idapp: {
type: String,
},
name: {
type: String,
},
surname: {
type: String,
},
bio: {
type: String,
},
img: {
type: String,
},
});
var Author = module.exports = mongoose.model('Author', AuthorSchema);
module.exports.getFieldsForSearch = function () {
return [
{ field: 'name', type: tools.FieldType.string },
{ field: 'surname', 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 Author.find(myfind).sort({name: 1, surname: 1});
};
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -122,4 +122,8 @@ bookingSchema.statics.findAllDistinctByBooking = function (idapp) {
const Booking = mongoose.model('Booking', bookingSchema); const Booking = mongoose.model('Booking', bookingSchema);
Booking.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Booking }; module.exports = { Booking };

View File

@@ -50,11 +50,11 @@ const BotSchema = new Schema({
}, },
}); });
BotSchema.statics.getFieldsForSearch = function() { BotSchema.statics.getFieldsForSearch = function () {
return [{ field: 'label', type: tools.FieldType.string }] return [{ field: 'label', type: tools.FieldType.string }]
}; };
BotSchema.statics.executeQueryTable = function(idapp, params) { BotSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params); return tools.executeQueryTable(this, idapp, params);
}; };
@@ -66,14 +66,147 @@ BotSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
}; };
BotSchema.statics.findAllIdApp = async function(idapp) { BotSchema.statics.generateBotMenuRecords = async function (idapp) {
try {
let arrrec = [
{
"page": 1,
"index": 1,
"riga": 1,
"active": true,
"label": "Vai al Sito",
"type": 3,
"value": "{host}",
"visibility": 0,
idapp,
"lang": "it",
"main": true
},
{
"page": 1,
"index": 1,
"riga": 2,
"active": true,
"label": "Il mio Profilo",
"type": 3,
"value": "{host}/my/{username}",
"visibility": 1,
idapp,
"lang": "it",
"main": true
},
{
"page": 1,
"index": 1,
"riga": 3,
"active": true,
"label": "Link da Condividere",
"type": 2,
"value": "{host}/registrati/{username}",
"visibility": 1,
idapp,
"lang": "it",
"main": true,
},
{
"page": 1,
"index": 2,
"riga": 1,
"active": true,
"label": "🔮 Help",
"type": 4,
"value": "",
"visibility": 0,
idapp,
"lang": "it",
"main": true,
},
{
"page": 1,
"index": 1,
"riga": 3,
"active": true,
"label": "💁‍♀️ Admin",
"type": 4,
"value": "",
"visibility": 5,
idapp,
"lang": "it",
"main": true
},
{
"page": 1,
"index": 2,
"riga": 2,
"active": true,
"label": "Imposta Foto Profilo",
"type": 4,
"value": "🖼 SetPicProfile",
"visibility": 1,
idapp,
"lang": "it",
"main": true
},
{
"page": 1,
"index": 2,
"riga": 3,
"active": true,
"label": "🛠 Strumenti",
"type": 1,
"value": "2",
"visibility": 1,
idapp,
"lang": "it",
"main": true,
},
{
"page": 2,
"index": 1,
"riga": 1,
"active": true,
"label": "🔑 Cambio Password",
"type": 4,
"value": "🔑 SetResetPwd",
"visibility": 1,
idapp,
"lang": "it",
},
{
"page": 2,
"index": 1,
"riga": 2,
"active": true,
"label": "👉🏻 Indietro",
"type": 1,
"value": "1",
"visibility": 1,
idapp,
"lang": "it",
}];
const ris = await MyBot.insertMany(arrrec);
return ris;
} catch (e) {
console.error('Err:', e);
}
}
BotSchema.statics.findAllIdApp = async function (idapp) {
const Bot = this; const Bot = this;
const myfind = {idapp}; const myfind = { idapp };
return await Bot.find(myfind).sort({page: 1, lang: 1, riga: 1, index: 1}).lean(); return await Bot.find(myfind).sort({ page: 1, lang: 1, riga: 1, index: 1 }).lean();
}; };
const MyBot = mongoose.model('Bot', BotSchema); const MyBot = mongoose.model('Bot', BotSchema);
module.exports = {MyBot}; MyBot.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyBot };

View File

@@ -76,4 +76,8 @@ CalZoomSchema.statics.getNextZoom = async function (idapp) {
const CalZoom = mongoose.model('CalZoom', CalZoomSchema); const CalZoom = mongoose.model('CalZoom', CalZoomSchema);
CalZoom.createIndexes((err) => {
if (err) throw err;
});
module.exports = { CalZoom }; module.exports = { CalZoom };

View File

@@ -1,29 +1,38 @@
const mongoose = require('mongoose').set('debug', false); const mongoose = require('mongoose').set('debug', false);
const Schema = mongoose.Schema; const Schema = mongoose.Schema;
const shared_consts = require('../tools/shared_nodejs'); mongoose.Promise = global.Promise;
mongoose.level = "F";
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const Order = require('../models/order');
const CartSchema = new Schema({ const CartSchema = new Schema({
idapp: { idapp: {
type: String, type: String,
}, },
userId: {type: Schema.Types.ObjectId, ref: 'User'}, userId: { type: Schema.Types.ObjectId, ref: 'User' },
totalQty: {type: Number, default: 0}, totalQty: { type: Number, default: 0 },
totalPrice: {type: Number, default: 0}, totalPrice: { type: Number, default: 0 },
totalPriceCalc: { type: Number, default: 0 },
department: { department: {
type: String, ref: 'Department', type: String, ref: 'Department',
}, },
items: [ items: [
{ {
order: order:
{type: Schema.Types.ObjectId, ref: 'Order'}, { type: Schema.Types.ObjectId, ref: 'Order' },
}, },
], ],
note: { note: {
type: String, type: String,
}, },
note_ordine_gas: {
type: String,
},
modify_at: { modify_at: {
type: Date, type: Date,
}, },
@@ -31,57 +40,75 @@ const CartSchema = new Schema({
var Cart = module.exports = mongoose.model('Cart', CartSchema); var Cart = module.exports = mongoose.model('Cart', CartSchema);
module.exports.findAllIdApp = async function(idapp, userId) { module.exports.findAllIdApp = async function (idapp, userId) {
const myfind = {idapp, userId}; const myfind = { idapp, userId };
return await Cart.findOne(myfind).lean(); return await Cart.findOne(myfind).lean();
}; };
module.exports.getCartByUserId = async function(uid, idapp) { module.exports.getCartByUserId = async function (uid, idapp) {
let query = {userId: uid, idapp}; try {
const mycart = await Cart.findOne(query).lean(); const Order = require('../models/order');
if (!!mycart) { let query = { userId: uid, idapp };
for (const idkey in mycart.items) { const mycart = await Cart.findOne(query).lean();
try {
idorder = mycart.items[idkey]._id.toString(); if (!!mycart) {
const myorder = mycart.items[idkey].order; for (const idkey in mycart.items) {
if (!!myorder) { try {
idorder = mycart.items[idkey].order._id.toString(); let idorder = mycart.items[idkey]._id.toString();
let myorder = mycart.items[idkey].order;
if (!!myorder) {
idorder = mycart.items[idkey].order._id.toString();
}
if (idorder) {
let myord = await Order.getTotalOrderById(idorder);
if (myord.length > 0) {
mycart.items[idkey].order = myord[0];
}
}
} catch (e) {
console.log('err', e);
} }
const myord = await Order.getTotalOrderById(idorder);
if (myord.length > 0) {
mycart.items[idkey].order = myord[0];
}
} catch (e) {
console.log('err', e);
} }
mycart.newitems = []
for (let item of mycart.items) {
if (item.order && item.order.hasOwnProperty('idapp') && (item.order.quantity > 0 || item.order.quantitypreordered > 0))
mycart.newitems.push(item)
}
mycart.items = [...mycart.newitems]
mycart.newitems = []
return mycart;
} }
return mycart; return null;
} catch (e) {
console.log('getCartByUserId err', e);
} }
return null;
}; };
module.exports.updateCartByUserId = function(userId, newCart, callback) { module.exports.updateCartByUserId = function (userId, newCart, callback) {
let query = {userId: userId}; let query = { userId: userId };
Cart.find(query, function(err, c) { Cart.find(query, function (err, c) {
if (err) throw err; if (err) throw err;
//exist cart in databse //exist cart in databse
if (c.length > 0) { if (c.length > 0) {
Cart.findOneAndUpdate( Cart.findOneAndUpdate(
{userId: userId}, { userId: userId },
{ {
$set: { $set: {
items: newCart.items, items: newCart.items,
totalQty: newCart.totalQty, totalQty: newCart.totalQty,
totalPrice: newCart.totalPrice, totalPrice: newCart.totalPrice,
userId: userId, totalPriceCalc: newCart.totalPriceCalc,
}, userId: userId,
}, },
{new: true}, },
callback, { new: true },
callback,
); );
} else { } else {
//no cart in database //no cart in database
@@ -90,22 +117,28 @@ module.exports.updateCartByUserId = function(userId, newCart, callback) {
}); });
}; };
module.exports.updateCartByCartId = async function(cartId, newCart) { module.exports.updateCartByCartId = async function (cartId, newCart) {
// delete newCart._doc._id; // delete newCart._doc._id;
const items = newCart.items; const items = newCart.items;
const totalQty = newCart.totalQty; const totalQty = newCart.totalQty;
const totalPrice = newCart.totalPrice; const totalPrice = newCart.totalPrice;
const totalPriceCalc = newCart.totalPriceCalc;
const note = newCart.note;
const note_ordine_gas = newCart.note_ordine_gas;
const modify_at = new Date(); const modify_at = new Date();
return await Cart.findOneAndUpdate({_id: cartId}, { return await Cart.findOneAndUpdate({ _id: cartId }, {
$set: { $set: {
items, items,
totalPrice, totalPrice,
totalPriceCalc,
totalQty, totalQty,
modify_at, note,
note_ordine_gas,
modify_at: new Date(),
}, },
}, {new: false}).lean().then((ris) => { }, { new: false }).lean().then((ris) => {
return ris; return ris;
}).catch(err => { }).catch(err => {
console.log('err', err); console.log('err', err);
@@ -114,11 +147,15 @@ module.exports.updateCartByCartId = async function(cartId, newCart) {
}; };
module.exports.deleteCartByCartId = async function(cartId) { module.exports.deleteCartByCartId = async function (cartId) {
return await Cart.remove({_id: cartId}); return await Cart.remove({ _id: cartId });
}; };
module.exports.createCart = async function(newCart) { module.exports.createCart = async function (newCart) {
return await newCart.save(); return await newCart.save();
}; };
Cart.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -1,127 +0,0 @@
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 CashSchema = new Schema({
idapp: {
type: String,
},
creatorUserId: {
type: String,
},
idCashCategory: {
type: String
},
idSubCashCategory: {
type: String
},
type: { // CashType: TYPE_IN, TYPE_OUT
type: Number
},
date_created: {
type: Date
},
date_payment: {
type: Date
},
descr: {
type: String,
},
price: {
type: Number
},
quantity: {
type: Number
},
total: {
type: Number
},
fromWalletUserId: { // walletCommonCash or any Member
type: String,
},
toWalletUserId: { // walletCommonCash or any Member
type: String,
},
walletStatus: { // WalletFinalStatusType: None: 0, InCommonCash: 1, InMyWallet : 2
type: Number,
},
walletTemporaryToUserId: { // WalletCommonCash
type: String,
},
walletCashId: {
type: String,
},
internal: {
type: Boolean,
default: false,
},
extra: {
type: Boolean,
default: false,
},
notes: {
type: String
},
confirmed: {
type: Boolean,
default: false,
},
});
var Cash = module.exports = mongoose.model('Cash', CashSchema);
module.exports.getFieldsForSearch = function () {
return []
};
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 Cash.find(myfind);
};
module.exports.getAllCash = function (query, sort, callback) {
Cash.find(query, null, sort, callback)
}
module.exports.getCashByUserId = function (userId, sort, callback) {
Cash.find({ userId }, null, sort, callback)
}
module.exports.getCashByID = function (id, callback) {
Cash.findById(id, callback);
}
module.exports.createCash = async function (Cash) {
const CashModel = new Cash(Cash);
return await CashModel.save(Cash)
.then((ris) => {
if (!!ris)
return ris._id;
return null;
});
}
// const Cash = mongoose.model('Cash', CashSchema);
// module.exports = { Cash };

View File

@@ -28,6 +28,10 @@ const CashCategorySchema = new Schema({
var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema); var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema);
CashCategory.createIndexes((err) => {
if (err) throw err;
});
module.exports.getFieldsForSearch = function () { module.exports.getFieldsForSearch = function () {
return [] return []
}; };
@@ -66,3 +70,4 @@ module.exports.createCashCategory = async function (CashCategory) {
return null; return null;
}); });
} }

View File

@@ -69,3 +69,7 @@ module.exports.createCashSubCategory = async function (CashSubCategory) {
return null; return null;
}); });
} }
module.exports.createIndexes((err) => {
if (err) throw err;
});

61
src/server/models/catai.js Executable file
View File

@@ -0,0 +1,61 @@
const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const CatAISchema = new Schema({
_id: {
type: Number,
},
name: {
type: String,
},
img: {
type: String,
},
icon: {
type: String,
},
color: {
type: String,
},
});
CatAISchema.statics.getAllCategories = function (callback) {
CatAI.find(callback)
}
CatAISchema.statics.getCatAIById = function (id, callback) {
CatAI.findById(id, callback);
}
CatAISchema.statics.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string }]
};
CatAISchema.statics.executeQueryTable = function (idapp, params) {
return tools.executeQueryTable(this, idapp, params);
};
CatAISchema.statics.findAllIdApp = async function (idapp) {
const myfind = {};
return await CatAI.find(myfind).sort({ name: 1 });
};
const CatAI = mongoose.model('CatAI', CatAISchema);
CatAI.createIndexes((err) => {
if (err) throw err;
});
module.exports = CatAI;

View File

@@ -50,4 +50,9 @@ CategorySchema.statics.findAllIdApp = async function (idapp) {
const Category = mongoose.model('Category', CategorySchema); const Category = mongoose.model('Category', CategorySchema);
Category.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Category }; module.exports = { Category };

View File

@@ -80,4 +80,8 @@ CatGrpSchema.statics.executeQueryTable = function (idapp, params) {
const CatGrp = mongoose.model('CatGrp', CatGrpSchema); const CatGrp = mongoose.model('CatGrp', CatGrpSchema);
CatGrp.createIndexes((err) => {
if (err) throw err;
});
module.exports = { CatGrp }; module.exports = { CatGrp };

62
src/server/models/catprod.js Executable file
View File

@@ -0,0 +1,62 @@
const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const CatProdSchema = new Schema({
idapp: {
type: String,
},
name: {
type: String,
},
img: {
type: String,
},
icon: {
type: String,
},
color: {
type: String,
},
});
CatProdSchema.statics.getAllCategories = function (callback) {
CatProd.find(callback)
}
CatProdSchema.statics.getCatProdById = function (id, callback) {
CatProd.findById(id, callback);
}
CatProdSchema.statics.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string }]
};
CatProdSchema.statics.executeQueryTable = function (idapp, params) {
return tools.executeQueryTable(this, idapp, params);
};
CatProdSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await CatProd.find(myfind).sort({ name: 1 });
};
const CatProd = mongoose.model('CatProd', CatProdSchema);
CatProd.createIndexes((err) => {
if (err) throw err;
});
module.exports = CatProd;

View File

@@ -43,5 +43,9 @@ CfgServerSchema.statics.findAllIdApp = async function(idapp) {
const CfgServer = mongoose.model('CfgServer', CfgServerSchema); const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
CfgServer.createIndexes((err) => {
if (err) throw err;
});
module.exports = {CfgServer}; module.exports = {CfgServer};

View File

@@ -84,9 +84,6 @@ const CircuitSchema = new Schema({
totCircolante: { totCircolante: {
type: Number, type: Number,
}, },
showAlways: {
type: Boolean,
},
totTransato: { totTransato: {
type: Number, type: Number,
}, },
@@ -227,6 +224,10 @@ const CircuitSchema = new Schema({
type: Number, type: Number,
default: 0, default: 0,
}, },
ignoreLimits: {
type: Boolean,
default: false,
},
}); });
CircuitSchema.pre('save', async function (next) { CircuitSchema.pre('save', async function (next) {
@@ -249,6 +250,18 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
return await Circuit.find(myfind, whatToShow).sort({ status: -1, numMembers: -1, name: 1 }); return await Circuit.find(myfind, whatToShow).sort({ status: -1, numMembers: -1, name: 1 });
}; };
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
const Circuit = this;
const mycirc = await Circuit.findOne({ _id: idrec }).lean();
if (mycirc) {
return mycirc.admins.some(admin => admin.username === username);
}
return false;
};
CircuitSchema.statics.getFieldsForSearch = function () { CircuitSchema.statics.getFieldsForSearch = function () {
return [ return [
{ field: 'name', type: tools.FieldType.string }, { field: 'name', type: tools.FieldType.string },
@@ -592,6 +605,7 @@ CircuitSchema.statics.getUsersSingleCircuit = async function (idapp, username, c
{ {
$project: { $project: {
username: 1, username: 1,
verified_by_aportador: 1,
name: 1, name: 1,
surname: 1, surname: 1,
profile: 1, profile: 1,
@@ -669,6 +683,7 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
const esisteDest = await Account.isExistAccountByUsernameAndCircuitId(idapp, extrarec.dest, circuittable._id, extrarec.groupdest, extrarec.contoComDest); const esisteDest = await Account.isExistAccountByUsernameAndCircuitId(idapp, extrarec.dest, circuittable._id, extrarec.groupdest, extrarec.contoComDest);
if (!esisteDest) { if (!esisteDest) {
// Fallo entrare anche sul Circuito (oltre ad aver creato l'Account). // Fallo entrare anche sul Circuito (oltre ad aver creato l'Account).
await User.addCircuitToUser(idapp, usernameOrig, extrarec.circuitname, false, extrarec.groupdest, extrarec.contoComDest); await User.addCircuitToUser(idapp, usernameOrig, extrarec.circuitname, false, extrarec.groupdest, extrarec.contoComDest);
@@ -694,21 +709,23 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
const circolantePrec = this.getCircolanteSingolaTransaz(accountorigTable, accountdestTable); const circolantePrec = this.getCircolanteSingolaTransaz(accountorigTable, accountdestTable);
// Check if Sender has enough money if (!circuittable.ignoreLimits) {
if (accountorigTable.saldo - myqty < -accountorigTable.fidoConcesso) { // Check if Sender has enough money
ris.cansend = false; if (accountorigTable.saldo - myqty < -accountorigTable.fidoConcesso) {
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_FIDO', usernameOrig); ris.cansend = false;
} ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_FIDO', usernameOrig);
}
if (accountdestTable.saldo + myqty > accountdestTable.qta_maxConcessa) { if (accountdestTable.saldo + myqty > accountdestTable.qta_maxConcessa) {
ris.cansend = false; ris.cansend = false;
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_QTAMAX', extrarec.dest); ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_QTAMAX', extrarec.dest);
}
} }
if (!onlycheck) { if (!onlycheck) {
// Add a Transaction ! // Add a Transaction !
if (ris.cansend) { if (ris.cansend) {
ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.notifId); ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.notifId, extrarec.idOrdersCart);
} }
if (ris.cansend && ris.rec) { if (ris.cansend && ris.rec) {
@@ -726,8 +743,8 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
}; };
await Circuit.updateOne({ _id: circuittable }, { $set: paramstoupdate }); await Circuit.updateOne({ _id: circuittable }, { $set: paramstoupdate });
extrarec.saldoOrig = accountorigTable.saldo; extrarec.saldoOrig = tools.arrotondaA2Decimali(accountorigTable.saldo);
extrarec.saldoDest = accountdestTable.saldo; extrarec.saldoDest = tools.arrotondaA2Decimali(accountdestTable.saldo);
let orig = usernameOrig; let orig = usernameOrig;
if (extrarec.grouporig) { if (extrarec.grouporig) {
@@ -1110,7 +1127,7 @@ CircuitSchema.statics.getListCircuitsByUsername = async function (idapp, usernam
if (account.groupname === '') { if (account.groupname === '') {
mystr += '\n👉🏻 ' + account.circuit.name + '\n'; mystr += '\n👉🏻 ' + account.circuit.name + '\n';
mystr += ' [Saldo: ' + account.saldo + ' RIS, '; mystr += ' [Saldo: ' + account.saldo + ' RIS, ';
mystr += ' Fido: ' + account.fidoConcesso + ' RIS, '; mystr += ' Fiducia: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Transato: ' + account.totTransato + ' RIS]'; mystr += ' Transato: ' + account.totTransato + ' RIS]';
} }
} }
@@ -1121,7 +1138,7 @@ CircuitSchema.statics.getListCircuitsByUsername = async function (idapp, usernam
if (myuser.profile.mycircuits.find((rec) => (rec.circuitname === account.circuit.name))) { if (myuser.profile.mycircuits.find((rec) => (rec.circuitname === account.circuit.name))) {
mystr += '\n GRUPPO: 👉🏻 <b>' + account.groupname + '</b> in ' + account.circuit.name + '\n'; mystr += '\n GRUPPO: 👉🏻 <b>' + account.groupname + '</b> in ' + account.circuit.name + '\n';
mystr += ' [Saldo: ' + account.saldo + ' RIS, '; mystr += ' [Saldo: ' + account.saldo + ' RIS, ';
mystr += ' Fido: ' + account.fidoConcesso + ' RIS, '; mystr += ' Fiducia: ' + account.fidoConcesso + ' RIS, ';
mystr += ' Transato: ' + account.totTransato + ' RIS]'; mystr += ' Transato: ' + account.totTransato + ' RIS]';
} }
} }
@@ -1161,64 +1178,491 @@ CircuitSchema.statics.SetDefMinMaxCollettivi = async function (idapp, valmin, va
CircuitSchema.statics.setFido = async function (idapp, username, circuitName, groupname) { CircuitSchema.statics.setFido = async function (idapp, username, circuitName, groupname) {
mycircuit = await Circuit.findOne({ idapp, name: circuitName }); try {
if (mycircuit) { mycircuit = await Circuit.findOne({ idapp, name: circuitName }).lean();
const circuitId = mycircuit._id; if (mycircuit) {
let account = null; const circuitId = mycircuit._id;
let fido = 0; let account = null;
let qtamax = 0; let fido = 0;
let qtamax = 0;
let variato = false;
let variato2 = false;
if (mycircuit.showAlways) { if (mycircuit.showAlways) {
const { User } = require('../models/user'); const { User } = require('../models/user');
const myuser = await User.getUserByUsername(idapp, username); const myuser = await User.getUserByUsername(idapp, username);
// Se è il circuito Nazionale, allora prende i valori dal proprio Circuito Locale: // Se è il circuito Nazionale, allora prende i valori dal proprio Circuito Locale:
const accountsuser = await Account.getUserAccounts(idapp, username); const accountsuser = await Account.getUserAccounts(idapp, username);
if (accountsuser) { if (accountsuser) {
// Se lo trovo della mia provincia, prendo quello // Se lo trovo della mia provincia, prendo quello
account = accountsuser.find((account) => account.circuit.strProv === myuser.profile.resid_province && account.circuit.card === myuser.profile.resid_card) account = accountsuser.find((account) => account.circuit.strProv === myuser.profile.resid_province && ((account.circuit.card === myuser.profile.resid_card) || !myuser.profile.resid_card))
if (!account && accountsuser.length > 0) { if (!account && accountsuser.length > 0) {
// Se non lo trovo, prendo il primo in cui sono entrato ! // Se non lo trovo, prendo il primo in cui sono entrato !
account = accountsuser[0]; account = accountsuser[0];
}
if (account && account.circuit) {
if (groupname) {
qtamax = account.circuit.qta_max_default_grp * shared_consts.CIRCUIT_CFG.MULT_FIDO_GROUP;
fido = account.circuit.fido_scoperto_default_grp * shared_consts.CIRCUIT_CFG.MULT_FIDO_GROUP;
} else {
qtamax = account.circuit.qta_max_default * shared_consts.CIRCUIT_CFG.MULT_FIDO_USER;
fido = account.circuit.fido_scoperto_default * shared_consts.CIRCUIT_CFG.MULT_FIDO_USER;
}
}
} else {
// Se non ho Circuiti locali, non applico il Fido !
return null;
} }
if (account && account.circuit) {
if (groupname) { } else {
qtamax = account.circuit.qta_max_default_grp * shared_consts.CIRCUIT_CFG.MULT_FIDO_GROUP; account = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, true, true, groupname, '');
fido = account.circuit.fido_scoperto_default_grp * shared_consts.CIRCUIT_CFG.MULT_FIDO_GROUP; if (groupname)
} else { fido = mycircuit.fido_scoperto_default_grp;
qtamax = account.circuit.qta_max_default * shared_consts.CIRCUIT_CFG.MULT_FIDO_USER; else
fido = account.circuit.fido_scoperto_default * shared_consts.CIRCUIT_CFG.MULT_FIDO_USER; fido = mycircuit.fido_scoperto_default;
}
if (account) {
if (qtamax > 0) {
variato = await Account.updateQtaMax(idapp, username, groupname, circuitId, qtamax);
}
const ris = await Account.updateFido(idapp, username, groupname, circuitId, fido);
if (ris) {
return { qta_maxConcessa: qtamax, fidoConcesso: fido, changed: variato || (ris && ris.nModified > 0) };
}
}
}
} catch (e) {
console.error('Err:', e);
}
return null;
};
CircuitSchema.statics.CheckTransazioniCircuiti = async function (correggi) {
const { User } = require('../models/user');
const { MyGroup } = require('../models/mygroup');
const { SendNotif } = require('../models/sendnotif');
const idapp = tools.RISO;
try {
console.log('--------- INIZIO CONTROLLO CheckTransazioniCircuiti -----------');
if (correggi)
console.log('CORREZIONE !');
else
console.log('SOLO VERIFICA');
if (correggi) {
// Trova tutti i documenti che contengono circuitname a null nell'array mycircuits
const usersWithNullCircuit = await User.find({ idapp, "profile.mycircuits.circuitname": null });
// Itera su ciascun documento
for (const user of usersWithNullCircuit) {
// Rimuove i campi null dall'array mycircuits
user.profile.mycircuits = user.profile.mycircuits.filter(circuit => circuit.circuitname !== null);
// Salva le modifiche al documento
await User.findOneAndUpdate({ _id: user._id }, { $set: { 'profile.mycircuits': user.profile.mycircuits } });
}
}
let usersWithDuplicateCircuits = await User.aggregate([
{
$unwind: "$profile.mycircuits"
},
{
$group: {
_id: {
userId: "$_id",
username: "$username",
circuitname: "$profile.mycircuits.circuitname"
},
count: { $sum: 1 }
}
},
{
$match: {
count: { $gt: 1 }
}
},
{
$group: {
_id: "$_id.userId",
username: { $first: "$_id.username" },
duplicatedCircuits: {
$push: "$_id.circuitname"
} }
} }
} else { }
// Se non ho Circuiti locali, non applico il Fido ! ]);
return false;
if (usersWithDuplicateCircuits.length > 0) {
console.log("Utenti con circuitname duplicati:");
usersWithDuplicateCircuits.forEach(user => {
console.log("Username:", user.username);
console.log("Circuiti duplicati:", user.duplicatedCircuits);
});
if (correggi) {
// CORREGGI DUPLICATI NEI CIRCUITI
for (const user of usersWithDuplicateCircuits) {
// Troviamo l'utente dal suo _id e aggiorniamo il suo documento
const arraycirc = await User.findOne({ _id: user._id }).lean();
let risdel = await User.updateOne(
{ _id: user._id },
{ $pull: { "profile.mycircuits": { circuitname: { $in: user.duplicatedCircuits } } } }
);
let risadd = await User.updateOne(
{ _id: user._id },
{ $push: { "profile.mycircuits": { $each: user.duplicatedCircuits.map(circuitname => ({ circuitname, date: arraycirc.profile.mycircuits.find((rec) => rec.circuitname === circuitname).date })) } } }
);
console.log('DEL', risdel, 'risadd', risadd);
}
} }
console.log("*** FINE DUPLICATI *** ");
} else { } else {
account = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, true, true, groupname, ''); console.log("Nessun utente ha circuitname duplicati.");
if (groupname)
fido = mycircuit.fido_scoperto_default_grp;
else
fido = mycircuit.fido_scoperto_default;
} }
if (account) { let numtransazionitot = 0;
if (qtamax > 0) {
await Account.updateQtaMax(idapp, username, groupname, circuitId, qtamax); const arrcircuits = await Circuit.find({ idapp }).lean();
for (const circuit of arrcircuits) {
let strusersnotinaCircuit = '';
let strusersnotExist = '';
numtransazionitot = 0;
let qta = 0;
let mystr = ''
// 1. Calcola la somma di tutti i Saldi
// prendo la lista di tutti gli account del circuito
let circuitId = circuit._id;
const accounts = await Account.find({ idapp, circuitId }).lean();
// CONTROLLA DUPLICATI !
const usernameCounts = accounts.reduce((acc, curr) => {
if (curr.username !== '') {
acc[curr.username] = (acc[curr.username] || 0) + 1;
}
return acc;
}, {});
const duplicatedUsernames = Object.keys(usernameCounts).filter(username => usernameCounts[username] > 1);
if (duplicatedUsernames.length > 0) {
mystr += ' Esistono username duplicati (escludendo quelli vuoti):' + duplicatedUsernames;
} }
const ris = await Account.updateFido(idapp, username, groupname, circuitId, fido); let saldotot = 0;
if (ris) {
return { qta_maxConcessa: qtamax, fidoConcesso: fido }; let ris = await User.find({
"profile.mycircuits": { $elemMatch: { circuitname: circuit.name } }
}, "username").lean()
let arrusers_byprofile = ris ? ris.map(user => user.username) : [];
let risgroups = await MyGroup.find({
"mycircuits": { $elemMatch: { circuitname: circuit.name } }
}, "groupname").lean()
let arrgroups_byprofile = risgroups ? risgroups.map(group => group.groupname) : [];
let arrusers_byaccounts = [];
let ind = 0
let stracc = '';
for (const account of accounts) {
let aggiorna = false;
if (account.username && !arrusers_byaccounts.includes(account.username)) {
arrusers_byaccounts.push(account.username);
} else if (account.groupname && !arrusers_byaccounts.includes(account.groupname)) {
arrusers_byaccounts.push(account.groupname);
} else if (account.contocom && !arrusers_byaccounts.includes(account.contocom)) {
arrusers_byaccounts.push(account.contocom);
}
// per ogni Account ricalcolo il numero di transazioni avvenute in Entrata/uscita
let result = await Movement.aggregate([
{
$match: {
$or: [
{ accountFromId: account._id },
{ accountToId: account._id },
]
}
},
{
$group: {
_id: null,
numtransactions: { $sum: 1 },
totTransato: { $sum: { $abs: "$amount" } },
saldo: {
$sum: {
$cond: [
{ $eq: ["$accountToId", account._id] },
"$amount",
{
$cond: [
{ $eq: ["$accountFromId", account._id] },
{ $multiply: ["$amount", -1] },
0
]
}
]
}
}
}
}
]);
let numtransactions = result && result.length > 0 ? result[0].numtransactions : 0;
let totTransato = result && result.length > 0 ? result[0].totTransato : 0;
let saldo = result && result.length > 0 ? result[0].saldo : 0;
// TRANSAZIONI PENDENTI:
let saldo_pend = 0;
let pendingtransactionsMittente = await SendNotif.getSumPendingTransactionsMittente(account.idapp, account.username, circuit.name, account.groupname);
if (pendingtransactionsMittente.length > 0) {
let saldopendingMitt = pendingtransactionsMittente.reduce((sum, rec) => sum + rec.extrarec.qty, 0);
// transatopending = pendingtransactionsMittente.reduce((sum, rec) => sum + Math.abs(rec.extrarec.qty), 0);
saldo_pend = saldo - saldopendingMitt;
} else {
saldo_pend = saldo;
}
let strtemp = '';
if (numtransactions > 0) {
if (correggi)
await Account.findOneAndUpdate({ _id: account._id }, { $set: { numtransactions } })
}
if (saldo !== account.saldo) {
aggiorna = true;
strtemp += ' SALDO DIFFERENTE ! => ' + '\nPRIMA: ' + account.saldo + '\nDOPO: ' + saldo;
if (correggi)
await Account.findOneAndUpdate({ _id: account._id }, { $set: { saldo } })
}
if (account.saldo_pend === undefined) {
await Account.findOneAndUpdate({ _id: account._id }, { $set: { saldo_pend: 0 } })
}
if (saldo_pend !== account.saldo_pend) {
aggiorna = true;
strtemp += ' SALDO_PENDENTE DIFF. ! => ' + '\nPRIMA: ' + account.saldo_pend + '\nDOPO: ' + saldo_pend;
if (correggi)
await Account.findOneAndUpdate({ _id: account._id }, { $set: { saldo_pend } })
}
if (!account.totTransato || (totTransato !== account.totTransato)) {
if (totTransato > account.totTransato || account.totTransato === undefined)
if (correggi)
await Account.findOneAndUpdate({ _id: account._id }, { $set: { totTransato } })
}
saldotot += account.saldo;
// if (account.totTransato === NaN || account.totTransato === undefined)
// stracc += ' TOTTRANSATO => ' + account.totTransato;
if (account.totTransato)
qta += account.totTransato;
if (account.numtransactions)
numtransazionitot += account.numtransactions;
if (aggiorna && strtemp) {
stracc += '\n ** Account ' + account.username + '\n' + strtemp;
}
// await account.calcPending();
ind++;
} }
let numaccounts = accounts.length;
let esistecontocom = accounts.find((rec) => (rec.hasOwnProperty('contocom') && rec.contocom !== ''));
let numacc_profile = arrusers_byprofile.length + arrgroups_byprofile.length;
if (esistecontocom && esistecontocom.contocom === circuit.path) {
numacc_profile++;
}
if (numacc_profile !== numaccounts) {
mystr += ' IL NUMERO DI UTENTI NON COINCIDONO ! \n';
mystr += 'Utenti Profilo = ' + numacc_profile + '\n';
mystr += 'Utenti Accounts = ' + arrusers_byaccounts.length + '\n';
}
saldotot = saldotot.toFixed(2);
// mystr += ' numaccounts=' + numaccounts;
if (strusersnotinaCircuit)
mystr += ' Utenti non presenti nel Circuito ! => ' + strusersnotinaCircuit;
if (strusersnotExist)
mystr += ' Utenti non più esistenti ! => ' + strusersnotExist;
// Verifica se saldotot è uguale a ZERO
if (saldotot != 0) {
mystr += '*** ATTENZIONE! ' + circuit.name + ' ha come somma un saldo di ' + saldotot + ' invece che ZERO';
} else {
if (numtransazionitot)
mystr += ' qta=' + qta + ' numtransazionitot ' + numtransazionitot;
}
if (mystr || stracc) {
console.log('************************* ' + circuit.name + ':');
console.log(mystr);
if (stracc)
console.log(stracc);
}
} }
console.log('--------- FINE CONTROLLO CheckTransazioniCircuiti -----------', 'Transazioni = ', numtransazionitot)
} catch (e) {
console.error('Err', e);
} }
return false;
};
CircuitSchema.statics.replaceAllCircuitNames = async function (idapp) {
const Circuit = this;
const { City } = require('../models/city');
const { Province } = require('../models/province');
const { MyGroup } = require('../models/mygroup');
const { User } = require('../models/user');
const myfind = { idapp };
let circuits = [];
try {
circuits = await Circuit.find(myfind);
let quanti = 0;
for (const circuit of circuits) {
if (!circuit || !circuit._id) {
console.error('Error: circuit is null or has no _id property');
continue;
}
const circuitId = circuit._id;
let provincia = '';
if (circuit.idCity && circuit.idCity.length > 0) {
provincia = await City.getProvinceByIdCity(circuit.idCity[0]);
}
if (!provincia)
provincia = circuit.strProv;
if (provincia) {
provincia = await Province.getStrProvinceByProv(provincia);
}
if (!provincia) {
console.log('PROVINCIA NON ESISTENTE !', circuit.name);
}
let path = '';
if (!circuit.showAlways) {
let newname = 'Circuito RIS ' + provincia;
// Se newname contiene 'ROMA', allora non aggiorna
if (circuit.name == 'RIS Roma Sud Est ' || circuit.name === 'Circuito RIS Roma Sud Est') {
newname = 'Circuito RIS Roma Sud Est';
} else if (circuit.name == 'Circuito RIS Roma Sud e Litora') {
newname = 'Circuito RIS Roma Sud e Litora';
} else if (circuit.name.trim() === 'RISO Roma Nord' || circuit.name.trim() === 'Circuito RISO Roma Nord') {
newname = 'Circuito RIS Roma Nord';
} else if (circuit.name == 'Circuito RIS Benevento' || circuit.name == 'Circuito RIS Campania') {
newname = 'Circuito RIS Campania';
path = 'riscampania';
} else if (circuit.name == 'Circuito RIS Milano Est') {
newname = 'Circuito RIS Milano Est';
} else if (circuit.name == 'Circuito RIS Repubblica di San Marino') {
newname = 'Circuito RIS Repubblica di San Marino';
}
if (((newname !== circuit.name) && (newname.indexOf('ROMA') === -1)) || path) {
console.log(`Sostituisci ${circuit.name} con ${newname}`);
quanti++;
if (path) {
// Update path
await Circuit.findOneAndUpdate({ _id: circuitId }, { $set: { path } })
.catch(e => console.error('Err ', e));
}
await Circuit.findOneAndUpdate({ _id: circuitId }, { $set: { name: newname } })
.catch(e => console.error('Err ', e));
// Rename profile.mycircuits.circuitname in User
await User.renameCircuitName(idapp, circuit.name, newname)
.catch(e => console.error('Err ', e));
await MyGroup.renameCircuitName(idapp, circuit.name, newname)
.catch(e => console.error('Err ', e));
}
}
}
console.log('Circuiti aggiornati: ' + quanti);
} catch (e) {
console.error('Err ', e);
return;
}
};
CircuitSchema.statics.addMovementByOrdersCart = async function (ordersCart, usernameDest, groupDest) {
const { User } = require('../models/user');
const idapp = ordersCart.idapp;
let extrarec = {
causal: 'Pagato Ordine n.' + ordersCart.numorder,
circuitname: 'Euro',
idOrdersCart: ordersCart._id,
qty: ordersCart.totalPrice,
dest: usernameDest,
groupdest: groupDest,
contoComDest: '',
};
const usernameOrig = await User.getUsernameById(idapp, ordersCart.userId);
return this.sendCoins(false, idapp, usernameOrig, extrarec);
}; };
const Circuit = mongoose.model('Circuit', CircuitSchema); const Circuit = mongoose.model('Circuit', CircuitSchema);
Circuit.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Circuit }; module.exports = { Circuit };

View File

@@ -8,7 +8,9 @@ mongoose.level = 'F';
const tools = require('../tools/general'); const tools = require('../tools/general');
const {ObjectID} = require('mongodb'); const { ObjectID } = require('mongodb');
const fs = require('fs-extra');
const shared_consts = require('../tools/shared_nodejs'); const shared_consts = require('../tools/shared_nodejs');
@@ -49,11 +51,14 @@ const CitySchema = new Schema({
type: String, type: String,
maxlength: 3, maxlength: 3,
}, },
geojson: {
type: Object, // Tipo che può contenere le features GeoJSON
},
}); });
CitySchema.pre('save', async function(next) { CitySchema.pre('save', async function (next) {
if (this.isNew) { if (this.isNew) {
const myrec = await City.findOne().limit(1).sort({_id: -1}); const myrec = await City.findOne().limit(1).sort({ _id: -1 });
if (!!myrec) { if (!!myrec) {
if (myrec._doc._id === 0) if (myrec._doc._id === 0)
this._id = 1; this._id = 1;
@@ -68,8 +73,8 @@ CitySchema.pre('save', async function(next) {
next(); next();
}); });
CitySchema.statics.getProvinceByIdCity = async function(idcity) { CitySchema.statics.getProvinceByIdCity = async function (idcity) {
const myrec = await City.findOne({_id: idcity}).lean(); const myrec = await City.findOne({ _id: idcity }).lean();
if (myrec) { if (myrec) {
return myrec.prov; return myrec.prov;
} }
@@ -77,10 +82,10 @@ CitySchema.statics.getProvinceByIdCity = async function(idcity) {
return ''; return '';
} }
CitySchema.statics.getCircuitNameBystrProv = async function(strProv) { CitySchema.statics.getCircuitNameBystrProv = async function (strProv) {
const { Circuit } = require('../models/circuit'); const { Circuit } = require('../models/circuit');
const myrec = await Circuit.findOne({strProv}).lean(); const myrec = await Circuit.findOne({ strProv }).lean();
if (myrec) { if (myrec) {
return myrec.name; return myrec.name;
} }
@@ -88,8 +93,8 @@ CitySchema.statics.getCircuitNameBystrProv = async function(strProv) {
return ''; return '';
} }
CitySchema.statics.getRegionByIdCity = async function(idcity) { CitySchema.statics.getRegionByIdCity = async function (idcity) {
const myrec = await City.findOne({_id: idcity}).lean(); const myrec = await City.findOne({ _id: idcity }).lean();
if (myrec) { if (myrec) {
return myrec.reg; return myrec.reg;
} }
@@ -97,13 +102,13 @@ CitySchema.statics.getRegionByIdCity = async function(idcity) {
return ''; return '';
} }
CitySchema.statics.findByCity = function(mycity) { CitySchema.statics.findByCity = function (mycity) {
let myregexp = new RegExp(mycity.trim().replace(' ', '|'), 'ig'); let myregexp = new RegExp(mycity.trim().replace(' ', '|'), 'ig');
const query = [ const query = [
{$match: {comune: {$regex: myregexp}}}, { $match: { comune: { $regex: myregexp } } },
{$sort: {descr: 1}}, { $sort: { descr: 1 } },
]; ];
return City.aggregate(query).then((arrrec) => { return City.aggregate(query).then((arrrec) => {
@@ -112,17 +117,17 @@ CitySchema.statics.findByCity = function(mycity) {
}; };
CitySchema.statics.getFieldsForSearch = function() { CitySchema.statics.getFieldsForSearch = function () {
return [ return [
{field: 'comune', type: tools.FieldType.string}, { field: 'comune', type: tools.FieldType.string },
{field: 'prov', type: tools.FieldType.string}, { field: 'prov', type: tools.FieldType.string },
{field: 'reg', type: tools.FieldType.string}, { field: 'reg', type: tools.FieldType.string },
{field: 'pref', type: tools.FieldType.number}, { field: 'pref', type: tools.FieldType.number },
{field: 'cap', type: tools.FieldType.number}, { field: 'cap', type: tools.FieldType.number },
]; ];
}; };
CitySchema.statics.executeQueryTable = function(idapp, params) { CitySchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = this.getFieldsForSearch();
const strfind = params.search; const strfind = params.search;
@@ -134,7 +139,7 @@ CitySchema.statics.executeQueryTable = function(idapp, params) {
return tools.executeQueryTable(this, 0, params); return tools.executeQueryTable(this, 0, params);
}; };
CitySchema.statics.executeQueryPickup = async function(idapp, params) { CitySchema.statics.executeQueryPickup = async function (idapp, params) {
const strfind = params.search; const strfind = params.search;
@@ -144,19 +149,19 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
let filterfindexact = {}; let filterfindexact = {};
if (strfind) { if (strfind) {
filterfindexact = {comune: strfind}; filterfindexact = { comune: strfind };
} }
let limit = 10; let limit = 10;
let risexact = []; let risexact = [];
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}}; let filterfind = { comune: { $regex: '^' + strfind, $options: 'i' } };
let aggr1 = [ let aggr1 = [
{ {
$match: {comune: strfind}, $match: { comune: strfind },
}, },
{ $limit : 1 }, { $limit: 1 },
{ {
$project: { $project: {
comune: { $concat: ["$comune", " (", "$prov", ")"] }, comune: { $concat: ["$comune", " (", "$prov", ")"] },
@@ -165,7 +170,7 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
]; ];
if (params.filter) { if (params.filter) {
filterfind = {...params.filter, ...filterfind}; filterfind = { ...params.filter, ...filterfind };
limit = 200; limit = 200;
} else { } else {
// risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean(); // risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
@@ -176,7 +181,7 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
{ {
$match: filterfind, $match: filterfind,
}, },
{ $limit : limit }, { $limit: limit },
{ {
$project: { $project: {
comune: { $concat: ["$comune", " (", "$prov", ")"] }, comune: { $concat: ["$comune", " (", "$prov", ")"] },
@@ -192,13 +197,85 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
}; };
CitySchema.statics.findAllIdApp = async function (idapp) {
CitySchema.statics.findAllIdApp = async function(idapp) {
const myfind = {}; const myfind = {};
return await City.find(myfind); return await City.find(myfind);
}; };
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
let ris = null;
if (prov)
ris = await City.find({ prov }).lean();
else
ris = await City.find({}).lean();
try {
if (ris) {
const arrjson = ris
.filter(record => record.geojson && typeof record.geojson === 'object' && record.geojson.geometry) // Prima filtra per mantenere solo gli oggetti con "geometry"
.map((record, index) => {
// Crea un nuovo oggetto con gli attributi desiderati da ogni record
const newRecord = {
...record.geojson, // Spread dell'oggetto geojson per prendere tutte le sue proprietà
id: (index + 1).toString(), // Aggiunge un valore "id" incrementale in base all'indice
};
// Aggiungi o aggiorna la proprietà "prov" in "properties" dentro l'oggetto geojson
if (newRecord.properties) {
newRecord.properties.prov = record.prov; // Se "properties" esiste già
} else {
newRecord.properties = { prov: record.prov }; // Crea "properties" se non esiste
}
return newRecord;
});
return arrjson;
}
return [];
} catch (e) {
console.error('Err', e);
}
return null
};
CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
try {
// Lettura del file GeoJSON
const geojson = await fs.readJson(nomefilejson); // Sostituisci con il percorso del tuo file GeoJSON
let inseriti = 0;
const numcomuni = geojson.features.length;
for (const citta of geojson.features) {
// Identifica il documento esistente in cui vuoi aggiungere le features
const reccity = await City.findOne({ istat: String(citta.properties.ISTAT).padStart(6, '0') });
if (reccity) {
const ris = await City.updateOne({ _id: reccity._id }, { $set: { geojson: citta } });
if (ris.ok === 1) {
inseriti++;
}
}
}
console.log(`${inseriti} su ${numcomuni} comuni inseriti.`);
} catch (e) {
console.error('Err', e);
}
};
const City = mongoose.model('City', CitySchema); const City = mongoose.model('City', CitySchema);
module.exports = {City}; City.createIndexes((err) => {
if (err) throw err;
});
module.exports = { City };

View File

@@ -25,10 +25,12 @@ const ContribtypeSchema = new Schema({
}); });
ContribtypeSchema.statics.getFieldsForSearch = function () { ContribtypeSchema.statics.getFieldsForSearch = function () {
return [{field: 'label', type: tools.FieldType.string}] return [{field: 'label', type: tools.FieldType.string}]
}; };
ContribtypeSchema.statics.executeQueryTable = function (idapp, params) { ContribtypeSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params); return tools.executeQueryTable(this, idapp, params);
}; };
@@ -47,9 +49,13 @@ ContribtypeSchema.statics.findAllIdApp = async function (idapp) {
return await Contribtype.find(myfind, (err, arrrec) => { return await Contribtype.find(myfind, (err, arrrec) => {
return arrrec return arrrec
}); }).lean();
}; };
const Contribtype = mongoose.model('Contribtype', ContribtypeSchema); const Contribtype = mongoose.model('Contribtype', ContribtypeSchema);
Contribtype.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Contribtype }; module.exports = { Contribtype };

View File

@@ -26,6 +26,10 @@ const departmentSchema = new Schema({
var Department = module.exports = mongoose.model('Department', departmentSchema); var Department = module.exports = mongoose.model('Department', departmentSchema);
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.getFieldsForSearch = function () { module.exports.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string }, return [{ field: 'name', type: tools.FieldType.string },
{ field: 'username', type: tools.FieldType.string } { field: 'username', type: tools.FieldType.string }

View File

@@ -106,4 +106,8 @@ DisciplineSchema.statics.DuplicateAllRecords = async function (idapporig, idappd
const Discipline = mongoose.model('Discipline', DisciplineSchema); const Discipline = mongoose.model('Discipline', DisciplineSchema);
Discipline.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Discipline }; module.exports = { Discipline };

View File

@@ -332,6 +332,9 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
const ExtraList = mongoose.model('ExtraList', ExtraListSchema); const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
ExtraList.createIndexes((err) => {
if (err) throw err;
});
module.exports = { ExtraList }; module.exports = { ExtraList };

View File

@@ -64,4 +64,8 @@ GallerySchema.statics.findAllIdApp = async function (idapp) {
const Gallery = mongoose.model('Gallery', GallerySchema); const Gallery = mongoose.model('Gallery', GallerySchema);
Gallery.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Gallery }; module.exports = { Gallery };

83
src/server/models/gasordine.js Executable file
View File

@@ -0,0 +1,83 @@
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 gasordineSchema = new Schema({
active: {
type: Boolean,
},
idapp: {
type: String,
},
name: {
type: String,
},
description: {
type: String,
},
referente: {
type: String,
},
city: {
type: String,
},
img: {
type: String,
},
note_ordine_gas: {
type: String,
},
dataora_chiusura_ordini: {
type: Date,
},
data_arrivo_merce: {
type: Date,
},
dataora_ritiro: {
type: Date,
},
dataora_termine_pagamento: {
type: Date,
},
});
var Gasordine = module.exports = mongoose.model('Gasordine', gasordineSchema);
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.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Gasordine.find(myfind);
};
module.exports.getGasordineByID = function (id, callback) {
Gasordine.findById(id, callback);
}
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -80,4 +80,8 @@ GoodSchema.statics.executeQueryTable = function (idapp, params) {
const Good = mongoose.model('Good', GoodSchema); const Good = mongoose.model('Good', GoodSchema);
Good.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Good }; module.exports = { Good };

View File

@@ -415,4 +415,8 @@ GraduatoriaSchema.statics.getPosizioneInGraduatoria = async function (idapp, ind
const Graduatoria = mongoose.model('Graduatoria', GraduatoriaSchema); const Graduatoria = mongoose.model('Graduatoria', GraduatoriaSchema);
Graduatoria.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Graduatoria }; module.exports = { Graduatoria };

View File

@@ -47,3 +47,6 @@ module.exports.findAllIdApp = async function (idapp) {
return await Group.find(myfind); return await Group.find(myfind);
}; };
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -228,3 +228,6 @@ module.exports.calculateHoursTodo = async function (idtodo) {
}; };
module.exports.createIndexes((err) => {
if (err) throw err;
});

View 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 ImportaMacroSchema = new Schema({
idapp: {
type: String,
},
_id: {
type: String,
},
});
var ImportaMacro = module.exports = mongoose.model('ImportaMacro', ImportaMacroSchema);
ImportaMacroSchema.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.getImportaMacroByCode = function (idapp, code) {
return ImportaMacro.findAllIdApp(idapp, code);
}
module.exports.getImportaMacroById = async function (id) {
const arrris = await ImportaMacro.findAllIdApp('', '', id);
return arrris && arrris.length > 0 ? arrris[0] : null
}
module.exports.findAllIdApp = async function (idapp) {
const ImportaMacro = this;
const myfind = { idapp, deleted: false };
return await ImportaMacro.find(myfind, (err, arrrec) => {
return arrrec;
});
};

View File

@@ -0,0 +1,59 @@
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 inventariogmSchema = new Schema({
idapp: {
type: String,
},
});
var Inventariogm = module.exports = mongoose.model('Inventariogm', inventariogmSchema);
inventariogmSchema.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.getInventariogmByCode = function (idapp, code) {
return Inventariogm.findAllIdApp(idapp, code);
}
module.exports.getInventariogmById = async function (id) {
const arrris = await Inventariogm.findAllIdApp('', '', id);
return arrris && arrris.length > 0 ? arrris[0] : null
}
module.exports.findAllIdApp = async function (idapp) {
const Inventariogm = this;
const myfind = { idapp, deleted: false };
return await Inventariogm.find(myfind, (err, arrrec) => {
return arrrec;
});
};

View File

@@ -196,3 +196,7 @@ module.exports.findAllIdApp = async function(idapp) {
return arrrec; return arrrec;
}); });
}; };
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -196,3 +196,7 @@ module.exports.findAllIdApp = async function (idapp) {
return arrrec return arrrec
}); });
}; };
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -73,4 +73,8 @@ LevelSchema.statics.executeQueryTable = function(idapp, params) {
const Level = mongoose.model('Level', LevelSchema); const Level = mongoose.model('Level', LevelSchema);
Level.createIndexes((err) => {
if (err) throw err;
});
module.exports = {Level}; module.exports = {Level};

View File

@@ -6,6 +6,7 @@ const tools = require('../tools/general');
mongoose.Promise = global.Promise; mongoose.Promise = global.Promise;
mongoose.level = "F"; mongoose.level = "F";
const { User } = require('./user');
// Resolving error Unknown modifier: $pushAll // Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => { mongoose.plugin(schema => {
@@ -13,112 +14,85 @@ mongoose.plugin(schema => {
}); });
const MailingListSchema = new Schema({ const MailingListSchema = new Schema({
idapp: {
type: String,
},
email: {
type: String,
trim: true,
},
hash: {
type: String,
},
name: {
type: String,
trim: true,
},
surname: {
type: String,
trim: true,
},
statesub: {
type: Boolean,
default: true
},
wrongerr: {
type: Boolean,
default: false
},
lastid_newstosent: {
type: String
}
}); });
MailingListSchema.statics.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string },
{ field: 'surname', type: tools.FieldType.string },
{ field: 'email', type: tools.FieldType.string }]
};
MailingListSchema.statics.executeQueryTable = function (idapp, params) { MailingListSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = User.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params); return tools.executeQueryTable(this, idapp, params);
}; };
MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) { MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
const MailingList = this;
const myfind = { idapp, statesub: true, wrongerr: { $ne: true } }; const myfind = {
idapp,
news_on: true,
$or: [
{ deleted: { $exists: false } },
{ deleted: { $exists: true, $eq: false } }],
$or: [
{ email_errata: { $exists: false } },
{ email_errata: { $exists: true, $ne: true } }],
};
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit. // Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return MailingList.find(myfind, (err, arrrec) => { return User.find(myfind, (err, arrrec) => {
return arrrec return arrrec
}); });
}; };
MailingListSchema.statics.getnumSent = async function (idapp, idmailinglist) { MailingListSchema.statics.getnumSent = async function (idapp, idUser) {
const MailingList = this;
const myfind = { idapp, statesub: true, lastid_newstosent: idmailinglist }; const myfind = { idapp, news_on: true, lastid_newstosent: idUser };
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit. // Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return await MailingList.countDocuments(myfind); return await User.countDocuments(myfind);
}; };
MailingListSchema.statics.isOk = async function (idapp, iduser, idmailinglist) { MailingListSchema.statics.isOk = async function (idapp, iduser, idUser) {
const MailingList = this;
const myfind = { idapp, _id: iduser, statesub: true, lastid_newstosent: { $ne: idmailinglist } };
const myfind = { idapp, _id: iduser, news_on: true, lastid_newstosent: { $ne: idUser } };
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit. // Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return await MailingList.countDocuments(myfind) > 0; return await User.countDocuments(myfind) > 0;
}; };
MailingListSchema.statics.findAllIdApp = async function (idapp) { MailingListSchema.statics.findAllIdApp = async function (idapp) {
const MailingList = this;
const myfind = { idapp }; const myfind = { idapp };
return await MailingList.find(myfind, (err, arrrec) => { return await User.find(myfind, (err, arrrec) => {
return arrrec return arrrec
}); });
}; };
MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) { MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) {
const MailingList = this;
let myperson = await MailingList.findOne({ idapp, hash }); let myperson = await User.findOne({ idapp, hash });
console.log('myperson', myperson);
if (!!myperson) { if (!!myperson) {
return (!myperson.statesub) return (!myperson.news_on)
} }
}; };
MailingListSchema.statics.findByHash = function (idapp, hash) { MailingListSchema.statics.findByHash = function (idapp, hash) {
const MailingList = this;
const myfind = { idapp, hash }; const myfind = { idapp, hash };
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit. // Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return MailingList.findOne(myfind, (err, rec) => { return User.findOne(myfind, (err, rec) => {
return rec return rec
}); });
}; };
const MailingList = mongoose.model('MailingList', MailingListSchema); const MailingList = mongoose.model('MailingList', MailingListSchema);
User.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MailingList }; module.exports = { MailingList };

View File

@@ -36,6 +36,7 @@ const MovementSchema = new Schema({
accountToId: { accountToId: {
type: String, type: String,
}, },
idOrdersCart: { type: Schema.Types.ObjectId, ref: 'OrdersCart' },
causal_table: { causal_table: {
type: String, type: String,
}, },
@@ -56,6 +57,10 @@ const MovementSchema = new Schema({
expiringDate: { expiringDate: {
type: Date, type: Date,
}, },
confirmed: {
type: Boolean,
default: false,
},
}); });
MovementSchema.statics.findAllIdApp = async function (idapp) { MovementSchema.statics.findAllIdApp = async function (idapp) {
@@ -90,7 +95,7 @@ MovementSchema.statics.executeQueryTable = function (idapp, params) {
return tools.executeQueryTable(this, 0, params); return tools.executeQueryTable(this, 0, params);
}; };
MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accountToIdTable, amount, causal, notifId) { MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accountToIdTable, amount, causal, notifId, idOrdersCart) {
try { try {
// Only positive values // Only positive values
@@ -98,11 +103,11 @@ MovementSchema.statics.addMov = async function (idapp, accountFromIdTable, accou
let mymov = await Movement.create( let mymov = await Movement.create(
{ {
_id: new ObjectID().toString(),
idapp, idapp,
transactionDate: new Date(), transactionDate: new Date(),
accountFromId: accountFromIdTable._id, accountFromId: accountFromIdTable._id,
accountToId: accountToIdTable._id, accountToId: accountToIdTable._id,
idOrdersCart,
amount, amount,
causal, causal,
residual: 0, residual: 0,
@@ -361,16 +366,20 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function (idapp, username
notifId: 1, notifId: 1,
'circuitfrom.symbol': 1, 'circuitfrom.symbol': 1,
'circuitto.symbol': 1, 'circuitto.symbol': 1,
'userfrom.verified_by_aportador': 1,
'userfrom.username': 1, 'userfrom.username': 1,
'userfrom.profile.img': 1, 'userfrom.profile.img': 1,
'userto.username': 1, 'userto.username': 1,
'userto.profile.img': 1, 'userto.profile.img': 1,
'userto.verified_by_aportador': 1,
'groupfrom.groupname': 1, 'groupfrom.groupname': 1,
'groupfrom.verified_by_aportador': 1,
'groupfrom.title': 1, 'groupfrom.title': 1,
'groupfrom.photos': 1, 'groupfrom.photos': 1,
'groupto.groupname': 1, 'groupto.groupname': 1,
'groupto.title': 1, 'groupto.title': 1,
'groupto.photos': 1, 'groupto.photos': 1,
'groupto.verified_by_aportador': 1,
'contocomfrom.path': 1, 'contocomfrom.path': 1,
'contocomfrom.name': 1, 'contocomfrom.name': 1,
'contocomto.path': 1, 'contocomto.path': 1,
@@ -693,4 +702,8 @@ MovementSchema.statics.checkIfCoinsAlreadySent = async function (notifId) {
const Movement = mongoose.model('Movement', MovementSchema); const Movement = mongoose.model('Movement', MovementSchema);
Movement.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Movement }; module.exports = { Movement };

View File

@@ -125,4 +125,8 @@ MsgTemplateSchema.statics.findAllIdApp = async function (idapp) {
const MsgTemplate = mongoose.model('MsgTemplate', MsgTemplateSchema); const MsgTemplate = mongoose.model('MsgTemplate', MsgTemplateSchema);
MsgTemplate.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MsgTemplate }; module.exports = { MsgTemplate };

View File

@@ -378,4 +378,8 @@ MyBachecaSchema.statics.getCompleteRecord = function (idapp, id) {
const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema); const MyBacheca = mongoose.model('MyBacheca', MyBachecaSchema);
MyBacheca.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyBacheca }; module.exports = { MyBacheca };

View File

@@ -210,4 +210,8 @@ MyElemSchema.statics.findAllIdApp = async function (idapp) {
const MyElem = mongoose.model('MyElem', MyElemSchema); const MyElem = mongoose.model('MyElem', MyElemSchema);
MyElem.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyElem }; module.exports = { MyElem };

View File

@@ -276,4 +276,8 @@ if (tools.INITDB_FIRSTIME) {
const MyEvent = mongoose.model('MyEvent', MyEventSchema); const MyEvent = mongoose.model('MyEvent', MyEventSchema);
MyEvent.createIndexes((err) => {
if (err) throw err;
});
module.exports = {MyEvent}; module.exports = {MyEvent};

View File

@@ -348,4 +348,8 @@ MyGoodSchema.statics.getProject = function () {
const MyGood = mongoose.model('MyGood', MyGoodSchema); const MyGood = mongoose.model('MyGood', MyGoodSchema);
MyGood.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyGood }; module.exports = { MyGood };

View File

@@ -309,7 +309,6 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function (idapp, groupname
const query = [ const query = [
{ $match: myfind }, { $match: myfind },
{ $unwind: '$mycircuits' },
{ {
$lookup: { $lookup: {
from: 'circuits', from: 'circuits',
@@ -337,6 +336,7 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function (idapp, groupname
]; ];
try { try {
const ris = await MyGroup.aggregate(query); const ris = await MyGroup.aggregate(query);
@@ -346,7 +346,7 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function (idapp, groupname
return null; return null;
} }
return ris; return null;
}; };
@@ -507,9 +507,26 @@ MyGroupSchema.statics.addCircuitFromGroup = async function (idapp, groupname, ci
// Rimuovo il Circuito all'interno del Gruppo // Rimuovo il Circuito all'interno del Gruppo
MyGroupSchema.statics.removeCircuitFromGroup = async function (idapp, groupname, circuitname) { MyGroupSchema.statics.removeCircuitFromGroup = async function (idapp, groupname, circuitname) {
return await this.updateOne({ idapp, groupname },
const ris = await this.updateOne({ idapp, groupname },
{ $pull: { 'mycircuits': { circuitname: { $in: [circuitname] } } } }); { $pull: { 'mycircuits': { circuitname: { $in: [circuitname] } } } });
const circuitId = await Circuit.getCircuitIdByName(idapp, circuitname);
let remove = false;
// Se il mio account non è stato utilizzato, allora lo cancello anche questo
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, false, groupname, '');
if (myaccount && myaccount.totTransato === 0) {
remove = true;
} else {
remove = true;
}
if (remove) {
await Account.removeAccount(myaccount._id);
}
}; };
MyGroupSchema.statics.getQueryReceiveRISGroups = function (idapp, hours) { MyGroupSchema.statics.getQueryReceiveRISGroups = function (idapp, hours) {
@@ -611,6 +628,13 @@ 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 } });
};
MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) { MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
return await this.findOneAndUpdate({ return await this.findOneAndUpdate({
@@ -626,4 +650,8 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
const MyGroup = mongoose.model('MyGroup', MyGroupSchema); const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
MyGroup.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyGroup }; module.exports = { MyGroup };

View File

@@ -348,4 +348,8 @@ MyHospSchema.statics.getProject = function () {
const MyHosp = mongoose.model('MyHosp', MyHospSchema); const MyHosp = mongoose.model('MyHosp', MyHospSchema);
MyHosp.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyHosp }; module.exports = { MyHosp };

View File

@@ -218,4 +218,8 @@ MyPageSchema.statics.findInternalPages = async function (idapp) {
const MyPage = mongoose.model('MyPage', MyPageSchema); const MyPage = mongoose.model('MyPage', MyPageSchema);
MyPage.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyPage }; module.exports = { MyPage };

View File

@@ -354,4 +354,8 @@ MySkillSchema.statics.getCompleteRecord = function (idapp, id) {
const MySkill = mongoose.model('MySkill', MySkillSchema); const MySkill = mongoose.model('MySkill', MySkillSchema);
MySkill.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MySkill }; module.exports = { MySkill };

View File

@@ -170,4 +170,8 @@ NewstosentSchema.statics.isActivated = async function (_id) {
const Newstosent = mongoose.model('Newstosent', NewstosentSchema); const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
Newstosent.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Newstosent }; module.exports = { Newstosent };

View File

@@ -118,4 +118,8 @@ OperatorSchema.statics.findAllIdApp = function (idapp) {
const Operator = mongoose.model('Operator', OperatorSchema); const Operator = mongoose.model('Operator', OperatorSchema);
Operator.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Operator }; module.exports = { Operator };

View File

@@ -43,4 +43,8 @@ OpzEmailSchema.statics.findAllIdApp = async function (idapp) {
const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema); const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema);
OpzEmail.createIndexes((err) => {
if (err) throw err;
});
module.exports = { OpzEmail }; module.exports = { OpzEmail };

View File

@@ -1,13 +1,15 @@
const mongoose = require('mongoose').set('debug', false) const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema; const Schema = mongoose.Schema;
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.Promise = global.Promise;
mongoose.level = "F"; mongoose.level = "F";
const fs = require('fs');
// Resolving error Unknown modifier: $pushAll // Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => { mongoose.plugin(schema => {
@@ -18,23 +20,19 @@ const orderSchema = new Schema({
idapp: { idapp: {
type: String, type: String,
}, },
userId: { userId: { type: Schema.Types.ObjectId, ref: 'User' },
type: String,
},
status: { status: {
type: Number, type: Number,
}, },
idProduct: { idProduct: { type: Schema.Types.ObjectId, ref: 'Product' },
type: String idProducer: { type: Schema.Types.ObjectId, ref: 'Producer' },
}, idStorehouse: { type: Schema.Types.ObjectId, ref: 'StoreHouse' },
idProducer: { idScontisticas: [{ type: Schema.Types.ObjectId, ref: 'Scontistica' }],
type: String idProvider: { type: Schema.Types.ObjectId, ref: 'Provider' },
}, idGasordine: { type: Schema.Types.ObjectId, ref: 'Gasordine' },
idStorehouse: {
type: String
},
price: { price: {
type: Number type: Number,
default: 0,
}, },
after_price: { after_price: {
type: String type: String
@@ -46,11 +44,65 @@ const orderSchema = new Schema({
type: String type: String
}, },
quantity: { quantity: {
type: Number type: Number,
default: 0,
},
quantitypreordered: {
type: Number,
default: 0,
},
TotalPriceProduct: {
type: Number,
default: 0,
},
TotalPriceProductstr: {
type: String,
},
TotalPriceProductCalc: {
type: Number,
default: 0,
},
confermato: { // e quindi è stato tolto dal magazzino (aggiornando il campo stockQty)
type: Boolean,
default: false,
},
date_confermato: {
type: Date
},
pagato: {
type: Boolean,
default: false,
},
date_pagato: {
type: Date
},
consegnato: {
type: Boolean,
default: false,
},
date_consegnato: {
type: Date
},
spedito: {
type: Boolean,
default: false,
},
date_spedito: {
type: Date
},
ricevuto: {
type: Boolean,
default: false,
},
date_ricevuto: {
type: Date
}, },
weight: { weight: {
type: Number type: Number
}, },
unit: {
type: Number
},
stars: { stars: {
type: Number type: Number
}, },
@@ -69,18 +121,27 @@ const orderSchema = new Schema({
date_delivered: { date_delivered: {
type: Date type: Date
}, },
notes: { note: {
type: String type: String
} },
modify_at: {
type: Date
},
}); });
var Order = module.exports = mongoose.model('Order', orderSchema); var Order = module.exports = mongoose.model('Order', orderSchema);
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.getFieldsForSearch = function () { module.exports.getFieldsForSearch = function () {
return [] return []
}; };
module.exports.executeQueryTable = function (idapp, params) { module.exports.executeQueryTable = function (idapp, params) {
const tools = require('../tools/general');
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, idapp, params); return tools.executeQueryTable(this, idapp, params);
}; };
@@ -89,26 +150,93 @@ module.exports.findAllIdApp = async function (idapp) {
const query = [ const query = [
{ $match: { idapp } }, { $match: { idapp } },
{ "$addFields": { "myidProd": { "$toObjectId": "$idProduct" } } },
{ "$addFields": { "myidProducer": { "$toObjectId": "$idProducer" } } },
{ {
$lookup: { $lookup: {
from: 'products', from: 'products',
localField: 'myidProd', localField: 'idProduct',
foreignField: '_id', foreignField: '_id',
as: 'product' as: 'product'
} }
}, },
{
$lookup: {
from: 'productinfos',
localField: 'product.idProduct',
foreignField: '_id',
as: 'product.productInfo'
}
},
{
$unwind: {
path: '$product.productInfo',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'producers', from: 'producers',
localField: 'myidProducer', localField: 'product.idProducer',
foreignField: '_id', foreignField: '_id',
as: 'producer' as: 'producer'
} }
}, },
{ $unwind: '$product' }, {
{ $unwind: '$producer' }, $lookup: {
from: 'providers',
localField: 'product.idProvider',
foreignField: '_id',
as: 'provider'
}
},
{
$lookup: {
from: 'gasordines',
localField: 'idGasordine',
foreignField: '_id',
as: 'gasordine'
}
},
{
$unwind: {
path: '$gasordine',
preserveNullAndEmptyArrays: true,
},
},
{
$match: {
$or: [
{ 'gasordine': { $exists: false } },
{ 'gasordine.active': true }
]
}
},
{
$lookup: {
from: 'scontisticas',
localField: 'product.idScontisticas',
foreignField: '_id',
as: 'scontistica'
}
},
{
$unwind: {
path: '$product',
preserveNullAndEmptyArrays: true,
},
},
{
$unwind: {
path: '$producer',
preserveNullAndEmptyArrays: true,
},
},
{
$unwind: {
path: '$provider',
preserveNullAndEmptyArrays: true,
},
},
]; ];
return await Order.aggregate(query) return await Order.aggregate(query)
@@ -129,52 +257,523 @@ module.exports.getOrderByID = function (id, callback) {
} }
module.exports.createOrder = async function (order) { module.exports.createOrder = async function (order) {
const orderModel = new Order(order);
return await orderModel.save(order) try {
.then((ris) => { if (order.idGasordine === '') {
if (!!ris) order.idGasordine = undefined;
return ris._id; }
return null; Order.updateTotals(order);
}); return await Order.create(order)
.then((ris) => {
if (!!ris)
return ris._id;
return null;
});
} catch (e) {
console.error('err', e);
}
}
module.exports.updateStatusOrders = async function (arrOrders, status) {
for (const order of arrOrders) {
let ret = await Order.updateOne({ _id: order.order._id }, { $set: { status } });
}
}
module.exports.updateStatusOrdersElements = async function (arrOrders, myelements) {
for (const order of arrOrders) {
const ret = await Order.findOneAndUpdate({ _id: order.order._id }, { $set: myelements });
}
}
module.exports.updateOrderByParams = async function (idOrder, paramstoupdate) {
const ris = await Order.findOneAndUpdate({ _id: idOrder }, { $set: paramstoupdate });
let myorder = await Order.findOne({ _id: idOrder }).lean();
if (paramstoupdate && !paramstoupdate.hasOwnProperty('TotalPriceProduct')) {
this.updateTotals(myorder);
await Order.findOneAndUpdate({ _id: idOrder }, { $set: myorder });
}
return myorder;
}
module.exports.updateTotals = function (order) {
try {
if (!order) {
return;
}
let mypricecalc = 0;
order.TotalPriceProduct = 0;
order.TotalPriceProductCalc = 0;
order.modify_at = new Date();
// Calcolo Sconto
let sconti_da_applicare = [];
if (order.scontisticas) {
let qtadascontare = order.quantity + order.quantitypreordered
let qtanonscontata = 0
while (qtadascontare > 0) {
let scontoapplicato = null
for (const sconto of order.scontisticas.filter((rec) => !rec.cumulativo)) {
if (qtadascontare >= sconto.qta) {
scontoapplicato = sconto
scontoapplicato.qtadascontare = sconto.qta
}
}
if (scontoapplicato && scontoapplicato.qtadascontare > 0) {
sconti_da_applicare.push(scontoapplicato)
qtadascontare -= scontoapplicato.qtadascontare
} else {
qtanonscontata = qtadascontare
qtadascontare = 0
}
}
/*for (const sconto of order.scontisticas.filter((rec) => rec.cumulativo)) {
if ((sconto.qta % order.quantity) === 0) {
sconti_da_applicare.push(sconto)
}
}*/
if (sconti_da_applicare.length > 0) {
for (const sconto of sconti_da_applicare) {
if (sconto.perc_sconto > 0) {
mypricecalc += (sconto.qtadascontare * order.price) * (1 - (sconto.perc_sconto / 100))
} else {
mypricecalc += sconto.price
}
}
}
if (qtanonscontata > 0) {
mypricecalc += order.price * qtanonscontata;
}
} else {
mypricecalc = (order.price * order.quantity) + (order.price * order.quantitypreordered);
}
order.TotalPriceProductCalc += mypricecalc;
order.TotalPriceProduct += mypricecalc;
order.TotalPriceProductstr = parseFloat(order.TotalPriceProduct.toFixed(2));
return order;
} catch (e) {
console.error('Err:', e);
}
} }
module.exports.getTotalOrderById = async function (id) { module.exports.getTotalOrderById = async function (id) {
const query = [ const query = [
{ $match: { _id: ObjectID(id) } }, { $match: { _id: ObjectID(id) } },
{ "$addFields": { "myidProd": { "$toObjectId": "$idProduct" } } },
{ "$addFields": { "myidProducer": { "$toObjectId": "$idProducer" } } },
{ "$addFields": { "myidStore": { "$toObjectId": "$idStorehouse" } } },
{ {
$lookup: { $lookup: {
from: 'products', from: 'products',
localField: 'myidProd', localField: 'idProduct',
foreignField: '_id', foreignField: '_id',
as: 'product' as: 'product'
} }
}, },
{
$unwind: {
path: '$product',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'productinfos',
localField: 'product.idProductInfo',
foreignField: '_id',
as: 'product.productInfo'
}
},
{
$unwind: {
path: '$product.productInfo',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'producers', from: 'producers',
localField: 'myidProducer', localField: 'product.idProducer',
foreignField: '_id', foreignField: '_id',
as: 'producer' as: 'producer'
} }
}, },
{
$unwind: {
path: '$producer',
preserveNullAndEmptyArrays: true,
},
},
{ {
$lookup: { $lookup: {
from: 'storehouses', from: 'storehouses',
localField: 'myidStore', localField: 'idStorehouse',
foreignField: '_id', foreignField: '_id',
as: 'storehouse' as: 'storehouse'
} }
}, },
{ $unwind: '$product' }, {
{ $unwind: '$producer' }, $unwind: {
{ $unwind: '$storehouse' }, path: '$storehouse',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'providers',
localField: 'product.idProvider',
foreignField: '_id',
as: 'provider'
}
},
{
$unwind: {
path: '$provider',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'gasordines',
localField: 'idGasordine',
foreignField: '_id',
as: 'gasordine'
}
},
{
$unwind: {
path: '$gasordine',
preserveNullAndEmptyArrays: true,
},
},
{
$match: {
$or: [
{ 'gasordine': { $exists: false } },
{ 'gasordine.active': true }
]
}
},
{
$lookup: {
from: 'scontisticas',
localField: 'product.idScontisticas',
foreignField: '_id',
as: 'scontisticas'
}
},
{
$lookup: {
from: 'orders',
let: { productId: '$product._id' },
pipeline: [
{
$match: {
$expr: {
$and: [
{ $eq: ['$idProduct', '$$productId'] },
{
$or: [
{
$eq: ['$status', shared_consts.OrderStatus.CHECKOUT_SENT]
},
{
$and: [{ $lt: ['$status', shared_consts.OrderStatus.CHECKOUT_SENT] },
{
$gt: [
'$modify_at',
{ $subtract: [new Date(), 60 * 60 * 1000] } // 1 hour in milliseconds 60 * 60
]
}]
}
]
}
]
}
},
},
{
$group: {
_id: null,
totalQty: { $sum: '$quantity' },
}
}
],
as: 'productOrders'
}
},
{
$lookup: {
from: 'orders',
let: { productId: '$product._id' },
pipeline: [
{
$match: {
$expr: {
$and: [
{ $eq: ['$idProduct', '$$productId'] },
{
$or: [
{
$eq: ['$status', shared_consts.OrderStatus.CHECKOUT_SENT]
},
{
$and: [{ $lt: ['$status', shared_consts.OrderStatus.CHECKOUT_SENT] },
{
$gt: [
'$modify_at',
{ $subtract: [new Date(), 60 * 60 * 1000] } // 1 hour in milliseconds 60 * 60
]
}]
}
]
}
]
}
}
},
{
$group: {
_id: null,
totalQtyPreordered: { $sum: '$quantitypreordered' }
}
}
],
as: 'productPreOrders'
}
},
{
$addFields: {
'product.QuantitaOrdinateInAttesa': {
$ifNull: [
{
$cond: {
if: { $isArray: '$productOrders' },
then: { $arrayElemAt: ['$productOrders.totalQty', 0] },
else: 0
}
},
0
]
},
'product.QuantitaPrenotateInAttesa': {
$ifNull: [
{
$cond: {
if: { $isArray: '$productPreOrders' },
then: { $arrayElemAt: ['$productPreOrders.totalQtyPreordered', 0] },
else: 0
}
},
0
]
},
},
},
{
$addFields: {
'product.quantityAvailable': {
$subtract: ["$product.stockQty", "$product.QuantitaOrdinateInAttesa"],
},
'product.bookableAvailableQty': {
$subtract: ["$product.maxbookableGASQty", "$product.QuantitaPrenotateInAttesa"],
}
}
},
{
$unset: 'productOrders'
},
{
$unset: 'productPreOrders'
},
]; ];
return await Order.aggregate(query); const ris = await Order.aggregate(query);
return ris;
}
module.exports.RemoveDeletedOrdersInOrderscart = async function () {
try {
const OrdersCart = require('./orderscart');
// Cancella gli Ordini che non esistono in OrdersCart
const arrorders = await OrdersCart.find({}).lean();
for (const rec of arrorders) {
let recordercart = await OrdersCart.getOrdersCartById(rec._id);
let arrord = []
let cambiare = false;
for (const recOrd of recordercart.items) {
if (recOrd.order) {
arrord.push(recOrd)
} else {
cambiare = true;
}
}
if (cambiare) {
await OrdersCart.findOneAndUpdate({ _id: recordercart._id }, { $set: { items: arrord } }, { new: false });
}
}
// Controllo se Order non esiste in OrdersCart
const arrord = await Order.find({}).lean();
for (const ord of arrord) {
const idtofind = ord._id;
await OrdersCart.findOne({ 'items.order': { $in: [idtofind] } })
.then(async (orderCart) => {
if (!orderCart) {
// NON TROVATO ! Allora lo cancello
await Order.findOneAndRemove({ _id: ord._id });
}
})
.catch(err => console.error(err));
}
} catch (e) {
console.error('Err', e);
}
};
module.exports.GeneraCSVOrdineProdotti = async function () {
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
const myquery = [
{ $match: { idGasordine: ObjectID(myidGasordine) } },
{
$lookup: {
from: 'products',
localField: 'idProduct',
foreignField: '_id',
as: 'product'
}
},
{
$unwind: {
path: '$product',
preserveNullAndEmptyArrays: true,
},
},
{
$lookup: {
from: 'productinfos',
localField: 'product.idProductInfo',
foreignField: '_id',
as: 'productInfo'
}
},
{
$unwind: {
path: '$productInfo',
},
},
{
$lookup: {
from: 'gasordines',
localField: 'idGasordine',
foreignField: '_id',
as: 'gasordine'
}
},
{
$unwind: {
path: '$gasordine',
preserveNullAndEmptyArrays: true,
},
},
{
$match: {
$or: [
{ 'gasordine.active': true }, // Include documents where gasordines.active is true
{ 'gasordine': { $exists: false } } // Include documents where gasordines array doesn't exist
]
}
},
{
$match: {
$or: [
{ quantity: { $gt: 0 }, },
{ quantitypreordered: { $gt: 0 }, }
]
}
},
{
$group: {
_id: "$product._id",
name: { $first: "$productInfo.name" },
weight: { $first: "$productInfo.weight" },
price_acquistato: { $first: "$product.price_acquistato" },
totalQuantity: { $sum: { $add: ["$quantity", "$quantitypreordered"] } },
totalPrice_acquistato: { $sum: { $multiply: ["$product.price_acquistato", { $add: ["$quantity", "$quantitypreordered"] }] } },
count: { $sum: 1 }
}
},
{
$sort: {
name: 1 // Sort in ascending order based on the "date_created" field
},
}
];
let myorderscart = await Order.aggregate(myquery);
console.log(myorderscart)
return generateCSV(myorderscart, 'outout.csv');
}
function generateCSV(data, outputPath) {
const headers = ['Num', 'Nome', 'Peso', 'Prezzo', 'Quantita', 'Totale', 'Ordini'];
const rows = data.map(item => {
const formattedPrice = item.price_acquistato.toString().replace(/\./g, ','); // Converti "." in ","
const total = item.totalPrice_acquistato.toString().replace(/\./g, ','); // Converti "." in ","
return [
0,
`"${item.name}"`,
item.weight,
formattedPrice,
item.totalQuantity,
total,
item.count
];
});
rows.unshift(headers);
const csvData = rows.map(row => row.join('|'));
fs.writeFile(outputPath, csvData.join('\n'), (err) => {
if (err) {
console.error('Error writing CSV file:', err);
} else {
console.log('CSV file has been successfully generated:', outputPath);
}
});
} }

File diff suppressed because it is too large Load Diff

View File

@@ -45,4 +45,8 @@ PaymentTypeSchema.statics.findAllIdApp = async function (idapp) {
const PaymentType = mongoose.model('Paymenttype', PaymentTypeSchema); const PaymentType = mongoose.model('Paymenttype', PaymentTypeSchema);
PaymentType.createIndexes((err) => {
if (err) throw err;
});
module.exports = { PaymentType }; module.exports = { PaymentType };

View File

@@ -57,4 +57,8 @@ PermissionSchema.statics.findAllIdApp = async function () {
const Permission = mongoose.model('Permission', PermissionSchema); const Permission = mongoose.model('Permission', PermissionSchema);
Permission.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Permission }; module.exports = { Permission };

View File

@@ -100,3 +100,7 @@ module.exports.getProducerByID = function (id, callback) {
// const Producer = mongoose.model('Producer', producerSchema); // const Producer = mongoose.model('Producer', producerSchema);
// module.exports = { Producer }; // module.exports = { Producer };
module.exports.createIndexes((err) => {
if (err) throw err;
});

File diff suppressed because it is too large Load Diff

221
src/server/models/productInfo.js Executable file
View File

@@ -0,0 +1,221 @@
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 productInfoSchema = new Schema({
idapp: {
type: String,
},
department: {
type: String, ref: 'Department'
},
code: {
type: String,
unique: true,
required: true,
},
id_wp: { // id in wordpress
type: String,
},
codice_EAN: {
type: String,
},
barcode: {
type: String,
},
name: {
type: String,
},
description: {
type: String,
},
short_descr: {
type: String,
},
idCatProds: [{ type: Schema.Types.ObjectId, ref: 'CatProd' }],
idSubCatProds: [{ type: Schema.Types.ObjectId, ref: 'SubCatProd' }],
color: {
type: String
},
size: {
type: String // 11x4x3
},
weight: {
type: Number
},
weight_lordo: {
type: Number
},
unit: {
type: Number,
default: 0,
},
unit_lordo: {
type: Number,
default: 0,
},
sfuso: { // serve se moltiplicare le qta (es: 12 kg) oppure fare (2 x 20 ml)
type: Boolean
},
vegan: {
type: Boolean
},
icon: {
type: String,
},
img: { // Se esiste img (sul server) visualizza questa, altrimenti vedi se esiste image_link
type: String,
},
image_link: {
type: String,
},
link_scheda: {
type: String,
},
link: {
type: String,
},
checkout_link: {
type: String,
},
img2: {
type: String,
},
img3: {
type: String,
},
img4: {
type: String,
},
ingredienti: {
type: String,
},
valori_nutrizionali: {
type: String,
},
note: {
type: String,
},
idAuthors: [{ type: Schema.Types.ObjectId, ref: 'Author' }],
idPublisher: { type: Schema.Types.ObjectId, ref: 'Publisher' },
collezione: {
type: String,
},
date_publishing: {
type: Date,
},
productType: {
type: Number,
},
});
var productInfo = module.exports = mongoose.model('ProductInfo', productInfoSchema);
module.exports.getFieldsForSearch = function () {
return [{ field: 'name', 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, code, id) {
let myfind = {};
let myqueryadd = {};
let query = [];
try {
if (idapp)
myfind = { idapp };
if (code) {
myfind = { ...myfind, code }
}
if (id) {
myqueryadd = {
$addFields: {
myId1: {
$toObjectId: id,
},
},
}
myfind = {
$expr: {
$eq: ["$_id", "$myId1"],
},
}
query.push(myqueryadd);
}
query.push(
{ $match: myfind },
{
$lookup: {
from: 'catprods',
localField: 'idCatProds',
foreignField: '_id',
as: 'catprods'
}
},
{
$lookup: {
from: 'authors',
localField: 'idAuthors',
foreignField: '_id',
as: 'authors'
}
},
{
$lookup: {
from: 'publishers',
localField: 'idPublisher',
foreignField: '_id',
as: 'publisher'
}
},
{
$lookup: {
from: 'subcatprods',
localField: 'idSubCatProds',
foreignField: '_id',
as: 'subcatprods'
}
},
{
$sort: {
name: 1 // 1 for ascending order, -1 for descending order
}
},
);
let ris = await productInfo.aggregate(query)
return ris;
} catch (e) {
console.error('E', e);
}
};
module.exports.getProductByCode = function (idapp, code) {
return productInfo.findAllIdApp(idapp, code);
}
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -428,5 +428,9 @@ ProjectSchema.pre('save', function (next) {
var Project = mongoose.model('Projects', ProjectSchema); var Project = mongoose.model('Projects', ProjectSchema);
Project.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Project }; module.exports = { Project };

64
src/server/models/provider.js Executable file
View File

@@ -0,0 +1,64 @@
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 providerSchema = new Schema({
idapp: {
type: String,
},
name: {
type: String,
},
description: {
type: String,
},
referent: {
type: String,
},
address: {
type: String,
},
city: {
type: String,
},
region: {
type: String,
},
img: {
type: String,
},
website: {
type: String,
},
});
var Provider = module.exports = mongoose.model('Provider', providerSchema);
module.exports.getFieldsForSearch = function () {
return [{ field: 'name', 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 Provider.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -8,7 +8,7 @@ mongoose.level = 'F';
const tools = require('../tools/general'); const tools = require('../tools/general');
const {ObjectID} = require('mongodb'); const { ObjectID } = require('mongodb');
const shared_consts = require('../tools/shared_nodejs'); const shared_consts = require('../tools/shared_nodejs');
@@ -35,18 +35,25 @@ const ProvinceSchema = new Schema({
link_grp: { link_grp: {
type: String, type: String,
}, },
card : { card: {
type: String, type: String,
}, },
link_telegram: { link_telegram: {
type: String, type: String,
}, },
}, { _id : false }); lat: {
type: Number,
},
long: {
type: Number,
},
}, { _id: false });
ProvinceSchema.pre('save', async function (next) { ProvinceSchema.pre('save', async function (next) {
if (this.isNew) { if (this.isNew) {
const myrec = await Province.findOne().limit(1).sort({_id:-1}); const myrec = await Province.findOne().limit(1).sort({ _id: -1 });
if (!!myrec) { if (!!myrec) {
if (myrec._doc._id === 0) if (myrec._doc._id === 0)
this._id = 1; this._id = 1;
@@ -61,8 +68,8 @@ ProvinceSchema.pre('save', async function (next) {
next(); next();
}); });
ProvinceSchema.statics.getRegionByStrProvince = async function(strprovince) { ProvinceSchema.statics.getRegionByStrProvince = async function (strprovince) {
const myrec = await Province.findOne({prov: strprovince}).lean(); const myrec = await Province.findOne({ prov: strprovince }).lean();
if (myrec) { if (myrec) {
return myrec.reg; return myrec.reg;
} }
@@ -70,8 +77,8 @@ ProvinceSchema.statics.getRegionByStrProvince = async function(strprovince) {
return ''; return '';
} }
ProvinceSchema.statics.getStrProvinceByProv = async function(prov) { ProvinceSchema.statics.getStrProvinceByProv = async function (prov) {
const myrec = await Province.findOne({prov}).lean(); const myrec = await Province.findOne({ prov }).lean();
if (myrec) { if (myrec) {
return myrec.descr; return myrec.descr;
} }
@@ -79,14 +86,14 @@ ProvinceSchema.statics.getStrProvinceByProv = async function(prov) {
return ''; return '';
} }
ProvinceSchema.statics.getFieldsForSearch = function() { ProvinceSchema.statics.getFieldsForSearch = function () {
return [ return [
{field: 'prov', type: tools.FieldType.string}, { field: 'prov', type: tools.FieldType.string },
{field: 'descr', type: tools.FieldType.string}, { field: 'descr', type: tools.FieldType.string },
]; ];
}; };
ProvinceSchema.statics.executeQueryTable = function(idapp, params) { ProvinceSchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch(); params.fieldsearch = this.getFieldsForSearch();
const strfind = params.search; const strfind = params.search;
@@ -98,7 +105,7 @@ ProvinceSchema.statics.executeQueryTable = function(idapp, params) {
return tools.executeQueryTable(this, 0, params); return tools.executeQueryTable(this, 0, params);
}; };
ProvinceSchema.statics.executeQueryPickup = async function(idapp, params) { ProvinceSchema.statics.executeQueryPickup = async function (idapp, params) {
const strfind = params.search; const strfind = params.search;
@@ -106,12 +113,12 @@ ProvinceSchema.statics.executeQueryPickup = async function(idapp, params) {
return []; return [];
} }
let filterfindexact = {descr: strfind}; let filterfindexact = { descr: strfind };
const risexact = await Province.find(filterfindexact).lean(); const risexact = await Province.find(filterfindexact).lean();
let filterfind = {}; let filterfind = {};
filterfind = {descr: {$regex: '^' + strfind, $options: 'i'}}; filterfind = { descr: { $regex: '^' + strfind, $options: 'i' } };
const ris = await Province.find(filterfind).lean().limit(10); const ris = await Province.find(filterfind).lean().limit(10);
@@ -119,12 +126,34 @@ ProvinceSchema.statics.executeQueryPickup = async function(idapp, params) {
}; };
ProvinceSchema.statics.findAllIdApp = async function(idapp) { ProvinceSchema.statics.findAllIdApp = async function (idapp) {
const myfind = {}; const myfind = {};
return Province.find(myfind).sort({descr: 1}); return Province.find(myfind).sort({ descr: 1 });
}; };
ProvinceSchema.statics.setCoordinatesOnDB = async function () {
const arrprov = await Province.find({}).lean();
// Funzione per ottenere le coordinate di tutte le città
for (const prov of arrprov) {
if (!prov.lat) {
let coord = await tools.getCityCoordinates(prov);
if (coord) {
let ris = await Province.findOneAndUpdate({ _id: prov._id }, { $set: { lat: coord.lat, long: coord.long } }, { new: true });
console.log(' *** Update ', prov.descr, 'lat', ris.lat, 'long', ris.long);
}
}
}
};
const Province = mongoose.model('Province', ProvinceSchema); const Province = mongoose.model('Province', ProvinceSchema);
module.exports = {Province}; Province.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Province };

50
src/server/models/publisher.js Executable file
View File

@@ -0,0 +1,50 @@
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 PublisherSchema = new Schema({
idapp: {
type: String,
},
name: {
type: String,
},
link: {
type: String,
},
img: {
type: String,
},
});
var Publisher = module.exports = mongoose.model('Publisher', PublisherSchema);
module.exports.getFieldsForSearch = function () {
return [
{ field: 'name', 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 Publisher.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});

86
src/server/models/queryai.js Executable file
View File

@@ -0,0 +1,86 @@
const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema;
mongoose.Promise = global.Promise;
mongoose.level = "F";
const tools = require('../tools/general');
// const CatAI = require('./catai');
const { ObjectID } = require('mongodb');
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
const QueryAISchema = new Schema({
idapp: {
type: String,
},
descr: {
type: String,
},
catAI: { type: Schema.Types.ObjectId, ref: 'CatAI' },
query: {
type: String,
},
ask: [
{
descr: {
type: String,
},
value: {
type: Number,
},
}
],
buttons: [
{
type: String, //ButtonCodeAction
},
],
output_type: {
type: String,
},
icon: {
type: String,
},
img: {
type: String,
},
});
QueryAISchema.statics.findAllIdApp = async function (idapp) {
const QueryAI = this;
const query = [
{ $sort: { descr: 1 } }
];
return await QueryAI
.aggregate(query)
.then((arrrec) => {
return arrrec
})
};
QueryAISchema.statics.getFieldsForSearch = function () {
return [{ field: 'descr', type: tools.FieldType.string }]
};
QueryAISchema.statics.executeQueryTable = function (idapp, params) {
params.fieldsearch = this.getFieldsForSearch();
return tools.executeQueryTable(this, 0, params);
};
const QueryAI = mongoose.model('QueryAI', QueryAISchema);
QueryAI.createIndexes((err) => {
if (err) throw err;
});
module.exports = { QueryAI };

View File

@@ -189,10 +189,10 @@ reactionSchema.statics.updateReactionsCounts = async function () {
risupdate = await mytable.updateOne({ _id: rec._id }, { risupdate = await mytable.updateOne({ _id: rec._id }, {
$set: { $set: {
numseen: ris.myreact.numseen | 0, numseen: ris.myreact.numseen ?? 0,
numfav: ris.myreact.numfav | 0, numfav: ris.myreact.numfav ?? 0,
numbook: ris.myreact.numbook | 0, numbook: ris.myreact.numbook ?? 0,
numattend: ris.myreact.numattend | 0, numattend: ris.myreact.numattend ?? 0,
} }
}) })
} }
@@ -433,4 +433,8 @@ reactionSchema.statics.removeBookmark = async function (
const Reaction = mongoose.model('Reaction', reactionSchema); const Reaction = mongoose.model('Reaction', reactionSchema);
Reaction.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Reaction }; module.exports = { Reaction };

View File

@@ -0,0 +1,62 @@
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 scontisticaSchema = new Schema({
idapp: {
type: String,
},
code: {
type: String,
},
description: {
type: String,
},
qta: {
type: Number,
},
perc_sconto: {
type: Number,
},
price: {
type: Number,
},
comulativo: {
type: Boolean,
default: false,
},
});
var Scontistica = module.exports = mongoose.model('Scontistica', scontisticaSchema);
module.exports.getFieldsForSearch = function () {
return [
{ field: 'code', 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.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Scontistica.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});

View File

@@ -20,6 +20,10 @@ const searchSchema = new Schema({
userId: { userId: {
type: String, type: String,
}, },
date_created: {
type: Date,
default: Date.now,
},
text: { text: {
type: String, type: String,
}, },
@@ -42,4 +46,8 @@ searchSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp, sall) {
const Search = mongoose.model('Search', searchSchema); const Search = mongoose.model('Search', searchSchema);
Search.createIndexes((err) => {
if (err) throw err;
});
module.exports = { Search }; module.exports = { Search };

Some files were not shown because too many files have changed in this diff Show More