Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ab24b2abd | ||
|
|
09a05a11d5 | ||
|
|
6c254a6a8e | ||
|
|
240a7be7f1 | ||
|
|
58839c32e1 | ||
|
|
b77a0579f1 | ||
|
|
6e8d1fcff1 | ||
|
|
192fd4706c | ||
|
|
fcc3755c19 | ||
|
|
97abe8b46d | ||
|
|
e40fbd550b | ||
|
|
3d4f8b0d04 | ||
|
|
95793fd73f | ||
|
|
4b4e3963ac | ||
|
|
85e2df56e1 | ||
|
|
58431c144c | ||
|
|
ad45ce60ee | ||
|
|
fba2ebd710 | ||
|
|
8e8a3204a7 | ||
|
|
e1ca4ef17f | ||
|
|
5431fe118e | ||
|
|
789dc1dcae | ||
|
|
76bacf3f5a | ||
|
|
d94cbde948 | ||
|
|
dfe492df45 | ||
|
|
6c50f35b2b | ||
|
|
a03c4cf613 | ||
|
|
7d845355a9 | ||
|
|
aeb83a512b | ||
|
|
e04247b1b6 | ||
|
|
f713f66369 | ||
|
|
f32bd189dc | ||
|
|
0017f04e45 | ||
|
|
65b29a6eee | ||
|
|
7827e49760 | ||
|
|
d106a59bb5 | ||
|
|
4758ce0857 | ||
|
|
6579c6bb3f | ||
|
|
6270991b76 | ||
|
|
f6d8e1bb0b | ||
|
|
f3597facd3 | ||
|
|
8363d65456 | ||
|
|
0a4cea94ae | ||
|
|
53a70a1c96 | ||
|
|
45d06b0923 | ||
|
|
757bf44c68 | ||
|
|
57679fe649 | ||
|
|
f8de205cf6 | ||
|
|
d77f9381e5 | ||
|
|
b643c7cdc3 | ||
|
|
f674791dbc | ||
|
|
3e9ab0af53 | ||
|
|
2f92dfe5b0 | ||
|
|
41d5f562ec | ||
|
|
341b4b8ec7 | ||
|
|
b56e25d1fa | ||
|
|
332b8992a9 | ||
|
|
5ba86e3641 | ||
|
|
39784aeb0e | ||
|
|
45be5038b9 | ||
|
|
c631ca9d6a | ||
|
|
fa075683ae | ||
|
|
836f7f572b | ||
|
|
9fb7df56e6 | ||
|
|
7f6ed73763 | ||
|
|
300bab2125 | ||
|
|
14b3e18986 | ||
|
|
14bca3e282 | ||
|
|
8803190313 | ||
|
|
c914555a5f | ||
|
|
351b81308a | ||
|
|
a42c365052 | ||
|
|
479934a8fb | ||
|
|
b1b952d120 | ||
|
|
73cf977754 | ||
|
|
f89281e316 | ||
|
|
b7ffd751dc | ||
|
|
3bdab927b6 | ||
|
|
fa1a2a7cdb | ||
|
|
5dac17d1d1 | ||
|
|
2ac1bc4b7d | ||
|
|
27aa42507a | ||
|
|
0d466f01b6 | ||
|
|
c82bc117cc | ||
|
|
491c9bc220 | ||
|
|
d438867e3a | ||
|
|
f9e0175f9b | ||
|
|
03e5d2ed81 | ||
|
|
ff1344c06f | ||
|
|
492f599cd9 |
22
.env.dev.pcb
@@ -4,34 +4,31 @@ PDB=mypassword@1A
|
||||
SEND_EMAIL=0
|
||||
SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","17","18"]
|
||||
appTelegram=["1","17","18"]
|
||||
appTelegram_TEST=["1","17"]
|
||||
appTelegram=["1","17"]
|
||||
appTelegram_DEVELOP=["17"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
AUTH_MONGODB=0
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
URLBASE_APP1=https://localhost
|
||||
PORT_APP1=8080
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
HTTPS_LOCALHOST=true
|
||||
DEBUG=0
|
||||
DEBUG=0
|
||||
VITE_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_CERT_KEY=localhost-key.pem
|
||||
PATH_SERVER_CRT=localhost.pem
|
||||
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
|
||||
@@ -43,4 +40,7 @@ SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||
SERVER_A_URL="http://51.77.156.69:3000"
|
||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
||||
@@ -6,33 +6,30 @@ SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
appTelegram_DEVELOP=["13"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
AUTH_MONGODB=0
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
URLBASE_APP1=https://localhost
|
||||
PORT_APP1=8080
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
HTTPS_LOCALHOST=true
|
||||
DEBUG=0
|
||||
DEBUG=0
|
||||
VITE_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_CERT_KEY=localhost-key.pem
|
||||
PATH_SERVER_CRT=localhost.pem
|
||||
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
|
||||
TOKEN_LIFE=1m
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
FTPSERVER_HOST=139.162.166.31
|
||||
FTPSERVER_PORT=21
|
||||
@@ -40,4 +37,5 @@ FTPSERVER_USER=ftpusrsrv_
|
||||
FTPSERVER_PWD=ftpmypwd@1A_
|
||||
AUTH_NEW_SITES=123123123
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||
|
||||
@@ -1,37 +1,34 @@
|
||||
DATABASE=test_FreePlanet
|
||||
DATABASE=test_PiuCheBuono
|
||||
UDB=paofreeplanet
|
||||
PDB=mypassword@1A
|
||||
SEND_EMAIL=0
|
||||
SEND_EMAIL_ORDERS=1
|
||||
PORT=3000
|
||||
appTelegram_TEST=["1","13"]
|
||||
appTelegram=["1","13"]
|
||||
appTelegram_TEST=["1","17"]
|
||||
appTelegram=["1","17"]
|
||||
appTelegram_DEVELOP=["17"]
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
AUTH_MONGODB=0
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
URLBASE_APP1=https://localhost
|
||||
PORT_APP1=8080
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
HTTPS_LOCALHOST=true
|
||||
DEBUG=0
|
||||
DEBUG=0
|
||||
VITE_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_CERT_KEY=localhost-key.pem
|
||||
PATH_SERVER_CRT=localhost.pem
|
||||
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
|
||||
@@ -40,4 +37,10 @@ FTPSERVER_USER=ftpusrsrv_
|
||||
FTPSERVER_PWD=ftpmypwd@1A_
|
||||
AUTH_NEW_SITES=123123123
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
|
||||
SERVER_A_URL="http://51.77.156.69:3000"
|
||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
||||
40
.env.prod.freeplanet.app
Normal file
@@ -0,0 +1,40 @@
|
||||
DATABASE=FreePlanet
|
||||
UDB=paofreeplanet
|
||||
PDB=suerteFreePlanet@1A
|
||||
SEND_EMAIL=1
|
||||
PORT=3000
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
||||
SERVERDIR_WEBSITE=/var/www/www.freeplanet_server
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:27017/
|
||||
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:27017/
|
||||
AUTH_MONGODB=1
|
||||
AUTH_DB_PASSING=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadminREAL@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
VITE_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=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"freeplanet.app","port":"3000"}]
|
||||
#DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
@@ -7,35 +7,38 @@ PORT=3000
|
||||
appTelegram_TEST=["17","18"]
|
||||
appTelegram=["17","18"]
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
||||
SERVERDIR_WEBSITE=
|
||||
DIRECTORY_SERVER=/var/www/nodejs_piuchebuono_server
|
||||
SERVERDIR_WEBSITE=/var/www/piuchebuono.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32001/
|
||||
DOMAIN_OFF=mongodb://localhost:32001/
|
||||
DOMAIN_AUTH_OLD=mongodb://{username}:{password}@127.0.0.1:32001/
|
||||
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:27030/
|
||||
AUTH_MONGODB=1
|
||||
AUTH_DB_PASSING=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadminREAL@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
VITE_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
|
||||
PATH_CERT_KEY=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
SECRTK=jAxKm02emx5SeJvz2IGmtRf6YqCgope
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNVZZ
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3000"},{"hostname":"gruppomacro.app","port":"3010"}]
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3030"},{"hostname":"gruppomacro.app","port":"3010"}]
|
||||
DOMAINS_ALLOWED=[]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
SERVER_A_URL="http://51.77.156.69:3000"
|
||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
||||
40
.env.prod.riso
Normal file
@@ -0,0 +1,40 @@
|
||||
DATABASE=FreePlanet
|
||||
UDB=paofreeplanet
|
||||
PDB=suerteFreePlanet@1A
|
||||
SEND_EMAIL=1
|
||||
PORT=0
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_riso_server
|
||||
SERVERDIR_WEBSITE=/var/www/riso.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN_OFF=mongodb://localhost:32015/
|
||||
DOMAIN_AUTH_OLD=mongodb://{username}:{password}@127.0.0.1:32015/
|
||||
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:27030/
|
||||
AUTH_MONGODB=1
|
||||
AUTH_DB_PASSING=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadminREAL@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
VITE_DEBUG=0
|
||||
LOCALE=0
|
||||
DELAY_SENDEMAIL=1000
|
||||
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||
PATH_CERT_KEY=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PROD=1
|
||||
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"riso.app","port":"3006"},{"hostname":"freeplanet.app","port":"3000"}]
|
||||
DOMAINS_ALLOWED=["comunitanuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"]
|
||||
#DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
@@ -8,22 +8,24 @@ appTelegram_TEST=["17","18"]
|
||||
appTelegram=["17","18"]
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_test.piuchebuono_server
|
||||
SERVERDIR_WEBSITE=test.piuchebuono.app
|
||||
SERVERDIR_WEBSITE=var/www/test.piuchebuono.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32002/
|
||||
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32002/
|
||||
AUTH_MONGODB=1
|
||||
AUTH_DB_PASSING=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
MONGODB_PWD=mypwadminS1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
VITE_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_CERT_KEY=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=0
|
||||
@@ -32,9 +34,12 @@ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3001"},{"hostname":"gruppomacro.app","port":"3011"}]
|
||||
DOMAINS=[{"hostname":"piuchebuono.app","port":"3031"},{"hostname":"gruppomacro.app","port":"3011"}]
|
||||
DOMAINS_ALLOWED=[]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||
SERVER_A_URL="http://51.77.156.69:3000"
|
||||
API_KEY_MSSQL="m68yADSr123MIVIDA@154$DSAGVOK"
|
||||
@@ -5,22 +5,24 @@ SEND_EMAIL=1
|
||||
PORT=3001
|
||||
ENABLE_PUSHNOTIFICATION=1
|
||||
DIRECTORY_SERVER=/var/www/nodejs_test.riso_server
|
||||
SERVERDIR_WEBSITE=test.riso.app
|
||||
SERVERDIR_WEBSITE=/var/www/test.riso.app
|
||||
PORT_APP1="0"
|
||||
DOMAIN=mongodb://localhost:32012/
|
||||
DOMAIN_AUTH=mongodb://{username}:{password}@127.0.0.1:32012/
|
||||
AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
AUTH_DB_PASSING=1
|
||||
MONGODB_USER="admin"
|
||||
MONGODB_PWD="mypwadminS1A"
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
VITE_DEBUG=1
|
||||
LOCALE=0
|
||||
DELAY_SENDEMAIL=1000
|
||||
VAPI_KEY_SUBJECT="mailto:surya@riso.app"
|
||||
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||
PATH_CERT_KEY=key.pem
|
||||
PATH_SERVER_CRT=cert.pem
|
||||
PATH_CERT_KEY=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=0
|
||||
@@ -29,7 +31,8 @@ SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||
TOKEN_LIFE=2h
|
||||
REFRESH_TOKEN_LIFE=14d
|
||||
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||
DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||
DOMAINS=[{"hostname":"riso.app","port":"3005"}]
|
||||
DOMAINS_ALLOWED=["comunitanuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"]
|
||||
SCRIPTS_DIR=admin_scripts
|
||||
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||
MIAB_HOST=box.lamiaposta.org
|
||||
|
||||
@@ -13,15 +13,15 @@ AUTH_MONGODB=1
|
||||
MONGODB_USER=admin
|
||||
MONGODB_PWD=mypwadmin@1A
|
||||
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||
DEBUG=0
|
||||
VITE_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_CERT_KEY=privkey.pem
|
||||
PATH_SERVER_CRT=fullchain.pem
|
||||
PATH_SSL_ROOT_PEM=root.pem
|
||||
PATH_SSL_CHAIN_PEM=chain.pem
|
||||
PROD=0
|
||||
|
||||
1
.gitignore
vendored
@@ -3,6 +3,7 @@ node_modules/
|
||||
.env.production
|
||||
.env.production.bak
|
||||
ESEMPI/
|
||||
OFF/
|
||||
.idea
|
||||
package-lock.json
|
||||
deploynodejs_on_production.sh
|
||||
|
||||
5
.vscode/launch.json
vendored
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch via Nodemon",
|
||||
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
|
||||
"restart": true,
|
||||
"runtimeExecutable": "node",
|
||||
"runtimeExecutable": "/usr/local/bin/node",
|
||||
"runtimeArgs": [
|
||||
"--inspect=9229" // Use "--inspect=0.0.0.0:9229" for remote debugging
|
||||
],
|
||||
@@ -30,7 +31,7 @@
|
||||
"name": "Launch Trace Warning",
|
||||
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
|
||||
"restart": true,
|
||||
"runtimeExecutable": "node",
|
||||
"runtimeExecutable": "/usr/local/bin/node",
|
||||
"runtimeArgs": [
|
||||
"--trace-warnings" // Use "--inspect=0.0.0.0:9229" for remote debugging
|
||||
],
|
||||
|
||||
148049
.yarn/releases/yarn-1.22.22.cjs
vendored
Executable file
5
.yarnrc
Normal file
@@ -0,0 +1,5 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
yarn-path ".yarn/releases/yarn-1.22.22.cjs"
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.test.risosrv
|
||||
source ./.env.prod.freeplanet.app
|
||||
|
||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
@@ -8,17 +8,14 @@ echo ""
|
||||
#!/bin/bash
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_USER="suryapaolo"
|
||||
REMOTE_HOST="servereng"
|
||||
REMOTE_PORT="8855"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
CONFIG_JS="ecosystem.config.testriso.js"
|
||||
ENV_FILE=".env.test.risosrv"
|
||||
ENV_OUT=".env.test"
|
||||
|
||||
#ENV_FILE=".env.prod.pcb"
|
||||
#ENV_OUT=".env.production"
|
||||
CONFIG_JS="ecosystem.config.prod_freeplanet.app.js"
|
||||
ENV_FILE=".env.prod.freeplanet.app"
|
||||
ENV_OUT=".env.production"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
@@ -63,8 +60,8 @@ rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||
echo "✅ Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
echo "❌ Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
76
OFF_deploynodejs_on_production.sh.off
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.production
|
||||
|
||||
msg="*** SERVER DI PRODUZIONE **** SEI SICURO DI INVIARE GLI AGGIORNAMENTI SERVERSIDE (NODE JS) - SUL SERVER DI PRODUZIONE ?? $SERVERDIR_WEBSITE (Y/N) ? "
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
echo "Sincronizzazione in corso NODEPRODUZIONE ... $SERVERDIR_WEBSITE/"
|
||||
echo ""
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="suryapaolo"
|
||||
REMOTE_HOST="servereng"
|
||||
REMOTE_PORT="8855"
|
||||
REMOTE_DIR="$SERVERDIR_WEBSITE"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"admin_scripts"
|
||||
"sass"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo
|
||||
|
||||
echo ""
|
||||
echo "*** Sincronizzazione Cartelle su $REMOTE_DIR ..."
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file .env.production ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
.env.production "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
ecosystem.config.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER PRODUZIONE! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -1,6 +1,6 @@
|
||||
db.myelems.insertMany([
|
||||
{
|
||||
"_id": ObjectId("669fbf9dc9d625d0628eb12f"),
|
||||
"_id": new ObjectId("669fbf9dc9d625d0628eb12f"),
|
||||
"order": 20,
|
||||
"active": true,
|
||||
"type": 20,
|
||||
@@ -13,14 +13,14 @@ db.myelems.insertMany([
|
||||
"__v": 0,
|
||||
"containerHtml": "<div style=\"text-align: center;\"><b><font size=\"4\">Abitare Gli Iblei</font></b></div>",
|
||||
"anim": {
|
||||
"_id": ObjectId("66e456981e0719a1012121c0"),
|
||||
"_id": new ObjectId("66e456981e0719a1012121c0"),
|
||||
"name": "",
|
||||
"clduration": "",
|
||||
"cldelay": "",
|
||||
"timingtype": "ease-in-out"
|
||||
}
|
||||
}, {
|
||||
"_id": ObjectId("669fbfc3c9d625d0628eb131"),
|
||||
"_id": new ObjectId("669fbfc3c9d625d0628eb131"),
|
||||
"order": 100,
|
||||
"active": true,
|
||||
"type": 145,
|
||||
@@ -32,7 +32,7 @@ db.myelems.insertMany([
|
||||
"list": [],
|
||||
"__v": 0
|
||||
}, {
|
||||
"_id": ObjectId("66db2a45054b3b09f85e6983"),
|
||||
"_id": new ObjectId("66db2a45054b3b09f85e6983"),
|
||||
"order": 26,
|
||||
"active": true,
|
||||
"type": 35,
|
||||
@@ -45,7 +45,7 @@ db.myelems.insertMany([
|
||||
"__v": 0,
|
||||
"image": "logo.jpg",
|
||||
"anim": {
|
||||
"_id": ObjectId("66db34215740efc77547a93a"),
|
||||
"_id": new ObjectId("66db34215740efc77547a93a"),
|
||||
"name": "",
|
||||
"clduration": "",
|
||||
"cldelay": "",
|
||||
@@ -55,7 +55,7 @@ db.myelems.insertMany([
|
||||
"align": 2
|
||||
}
|
||||
, {
|
||||
"_id": ObjectId("66db38a77e24f4509eef655b"),
|
||||
"_id": new ObjectId("66db38a77e24f4509eef655b"),
|
||||
"order": 26,
|
||||
"active": true,
|
||||
"type": 20,
|
||||
@@ -68,7 +68,7 @@ db.myelems.insertMany([
|
||||
"__v": 0,
|
||||
"containerHtml": "<style>\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 20px;\n background-color: #f0f0f0;\n color: #333;\n}\n\nh1 {\n color: #0056b3;\n text-align: center;\n}\n\n\np, li {\n line-height: 1.6;\n}\n\n\nul {\n list-style-type: none;\n padding: 0;\n}\n\n\nli {\n background-color: #fff !important;\n margin-bottom: 10px !important;\n padding: 10px !important;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important; \n}\n\n\na {\n color: #007bff;\n text-decoration: none;\n}\n\n\na:hover {\n text-decoration: underline;\n}\n\n\n.container {\n max-width: 800px;\n margin: 0 auto;\n background-color: #fff;\n padding: 20px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n}\n\n\n.strong {\n font-weight: bold;\n}\n</style>\n\n\n<p><strong>“Abitare gli Iblei”</strong> è una rete aperta che ha lo scopo di riunire tutte quelle persone che vogliono valorizzare e qualificare la vita nel territorio degli Iblei. </p>\n \n <p>Chi aderisce alla rete si riconosce in una <strong>Carta dei valori comuni</strong> e usa la rete per scambiare conoscenze, esperienze, risorse e prodotti sviluppati nell’ambito delle proprie iniziative (profit e non profit) individuali o collettive.</p>\n\n\n <p>L’area territoriale di questa rete è quella dei <strong>Monti Iblei orientali e occidentali</strong> (Noto, Avola, Canicattini, Siracusa, Palazzolo, Buccheri, Ferla, Modica, …).</p>\n\n\n <p>La rete <strong>“Abitare gli Iblei”</strong> offre i seguenti servizi utili per il territorio ed i suoi abitanti, frutto di una costruzione collettiva:</p>\n \n <ul>\n <li><strong>1. Mappa delle attività virtuose:</strong> permette di identificare attività pubbliche e private nel territorio che possono essere utili nella vita quotidiana. Queste attività possono riguardare artigiani, produttori o fornitori di servizi di cui almeno un membro della rete conosca la qualità e l’affidabilità (agricoltori, falegnami, fabbri, idraulici, imprese edili, strutture ricettive, …). Altre informazioni utili possono riguardare associazioni/istituzioni operanti in vari settori. – <strong>Accesso pubblico</strong></li>\n <li><strong>2. Calendario:</strong> permette di accedere ad annunci di eventi utili alla crescita culturale del territorio. La pubblicazione di eventi è riservata ai soli membri della rete che possono presentare iniziative anche di altri organizzatori. – <strong>Accesso pubblico</strong></li>\n <li><strong>3. Scambi di servizi, prodotti e ospitalità:</strong> questa funzione è riservata ai soli membri della rete e si realizza attraverso la Rete italiana di scambi orizzontali (RISO). – <strong>Accesso riservato</strong></li>\n <li><strong>4. Segnalazione di pericoli per il territorio:</strong> attraverso questa mappa è possibile segnalare incendi, immondizia abbandonata, discariche abusive, fonti di inquinamento per corsi d’acqua e spiagge, presenza di inquinamento nell’aria, … – <strong>Accesso riservato</strong></li>\n </ul>\n \n <p>Se vuoi aderire alla rete puoi richiederne la registrazione utilizzando questo Link <a href=\"#\"><strong>(Pagina in Costruzione)</strong></a>.</p>\n\n",
|
||||
"anim": {
|
||||
"_id": ObjectId("66db393e3b885ccdfaed28d6"),
|
||||
"_id": new ObjectId("66db393e3b885ccdfaed28d6"),
|
||||
"name": "",
|
||||
"clduration": "",
|
||||
"cldelay": "",
|
||||
@@ -76,7 +76,7 @@ db.myelems.insertMany([
|
||||
}
|
||||
}
|
||||
, {
|
||||
"_id": ObjectId("66e41cff78c8d880eebfbf1c"),
|
||||
"_id": new ObjectId("66e41cff78c8d880eebfbf1c"),
|
||||
"order": 32.5,
|
||||
"active": true,
|
||||
"type": 20,
|
||||
@@ -89,7 +89,7 @@ db.myelems.insertMany([
|
||||
"__v": 0,
|
||||
"containerHtml": "ORAAAA",
|
||||
"anim": {
|
||||
"_id": ObjectId("66e459421e0719a1012123ad"),
|
||||
"_id": new ObjectId("66e459421e0719a1012123ad"),
|
||||
"name": "",
|
||||
"clduration": "",
|
||||
"cldelay": "",
|
||||
@@ -98,7 +98,7 @@ db.myelems.insertMany([
|
||||
}
|
||||
,
|
||||
{
|
||||
"_id": ObjectId("66e4270d78c8d880eebfbf24"),
|
||||
"_id": new ObjectId("66e4270d78c8d880eebfbf24"),
|
||||
"order": 40,
|
||||
"active": true,
|
||||
"type": 20,
|
||||
@@ -111,14 +111,14 @@ db.myelems.insertMany([
|
||||
"__v": 0,
|
||||
"containerHtml": "BBB",
|
||||
"anim": {
|
||||
"_id": ObjectId("66e4568d1e0719a1012121a6"),
|
||||
"_id": new ObjectId("66e4568d1e0719a1012121a6"),
|
||||
"name": "",
|
||||
"clduration": "",
|
||||
"cldelay": "",
|
||||
"timingtype": "ease-in-out"
|
||||
}
|
||||
}, {
|
||||
"_id": ObjectId("66e45b0c78c8d880eebfbf45"),
|
||||
"_id": new ObjectId("66e45b0c78c8d880eebfbf45"),
|
||||
"order": 70,
|
||||
"active": true,
|
||||
"type": 20,
|
||||
@@ -136,7 +136,7 @@ db.myelems.insertMany([
|
||||
db.sites.insert(
|
||||
/* 1 */
|
||||
{
|
||||
"_id": ObjectId("669fbef7fc704b8912263af9"),
|
||||
"_id": new ObjectId("669fbef7fc704b8912263af9"),
|
||||
"confpages": {
|
||||
"font": "",
|
||||
"col_toolbar": "",
|
||||
@@ -235,7 +235,7 @@ db.sites.insert(
|
||||
|
||||
db.users.insert(
|
||||
{
|
||||
"_id": ObjectId("669fbef7c9d625d0628eb12d"),
|
||||
"_id": new ObjectId("669fbef7c9d625d0628eb12d"),
|
||||
"profile": {
|
||||
"paymenttypes": [],
|
||||
"notif_idCities": [],
|
||||
@@ -343,7 +343,7 @@ db.users.insert(
|
||||
"tokens": [
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
||||
"_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||
"_id": new ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
||||
@@ -351,7 +351,7 @@ db.users.insert(
|
||||
},
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
||||
"_id": ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||
"_id": new ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
||||
|
||||
@@ -14,7 +14,7 @@ db.mygroups.insert(
|
||||
"photos": [],
|
||||
"admins": [
|
||||
{
|
||||
"_id": ObjectId("66e2e6276b502b07f1e89571"),
|
||||
"_id": new ObjectId("66e2e6276b502b07f1e89571"),
|
||||
"username": "paoloar77"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
db.mypages.insertMany([
|
||||
{
|
||||
"_id": ObjectId("66db21118009ea4503bb6a01"),
|
||||
"_id": new ObjectId("66db21118009ea4503bb6a01"),
|
||||
"order": 10,
|
||||
"idapp": "19",
|
||||
"path": "home",
|
||||
@@ -8,7 +8,7 @@ db.mypages.insertMany([
|
||||
"title": "Home",
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("66db21118009ea4503bb6a03"),
|
||||
"_id": new ObjectId("66db21118009ea4503bb6a03"),
|
||||
"order": 10,
|
||||
"idapp": "19",
|
||||
"path": "home_logout",
|
||||
@@ -16,7 +16,7 @@ db.mypages.insertMany([
|
||||
"title": "Home NoLoggato",
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("66e322dd5a6360e3b3c71c5a"),
|
||||
"_id": new ObjectId("66e322dd5a6360e3b3c71c5a"),
|
||||
"order": 40,
|
||||
"idapp": "19",
|
||||
"path": "presentazione",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
db.users.insertMany([
|
||||
{
|
||||
"_id": ObjectId("66db21115281b23462d496d2"),
|
||||
"_id": new ObjectId("66db21115281b23462d496d2"),
|
||||
"profile": {
|
||||
"paymenttypes": [],
|
||||
"notif_idCities": [],
|
||||
@@ -66,7 +66,7 @@ db.users.insertMany([
|
||||
"tokens": [
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3Mjc3MjI0NjV9.EOvF89kswT1eqVJCSwVMMI-jB4kokP-aQVhi7xSUods",
|
||||
"_id": ObjectId("66e87ee1bbe2ce0f77adf6b8"),
|
||||
"_id": new ObjectId("66e87ee1bbe2ce0f77adf6b8"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZkYjIxMTE1MjgxYjIzNDYyZDQ5NmQyIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG9hcjc3IiwiaWF0IjoxNzI2NTEyODY1LCJleHAiOjE3MjY1MjAwNjV9.ESvyTWmXhfAQ0i-wwjxZR1A1Y5Bwixb60uG_UcOPQ5Y",
|
||||
@@ -90,7 +90,7 @@ db.users.insertMany([
|
||||
"useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("66e49515d18d313a144ead56"),
|
||||
"_id": new ObjectId("66e49515d18d313a144ead56"),
|
||||
"profile": {
|
||||
"paymenttypes": [],
|
||||
"notif_idCities": [],
|
||||
@@ -187,7 +187,7 @@ db.users.insertMany([
|
||||
"tokens": [
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3Mjc1NTY5MTV9.NHnFUXOL0MbjRs9F6HrQsEBRGXG89AsBYP7jU9m8icY",
|
||||
"_id": ObjectId("66e5f83392c9540e18f89730"),
|
||||
"_id": new ObjectId("66e5f83392c9540e18f89730"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNDk1MTVkMThkMzEzYTE0NGVhZDU2IiwiYWNjZXNzIjoiYXV0aCIsInVuIjoicGFvbG90ZXN0IiwiaWF0IjoxNzI2MzQ3MzE1LCJleHAiOjE3MjYzNTQ1MTV9.HTr1kNMhBU_38R2Tfy6m22XCbiRh5IsBKC3fl0ipIgM",
|
||||
@@ -207,7 +207,7 @@ db.users.insertMany([
|
||||
"perm": 16
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("66e6fb5aac95a84fd0e11881"),
|
||||
"_id": new ObjectId("66e6fb5aac95a84fd0e11881"),
|
||||
"profile": {
|
||||
"paymenttypes": [],
|
||||
"notif_idCities": [],
|
||||
@@ -304,7 +304,7 @@ db.users.insertMany([
|
||||
"tokens": [
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI3NjIzNjY1fQ.6QaBaiE1pv7mDy7S8YUReqH8m0CCK7jTmd57eGHgnzE",
|
||||
"_id": ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||
"_id": new ObjectId("66e6fcf1ac95a84fd0e11b2c"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.6613.127 Mobile Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQxNDA2NSwiZXhwIjoxNzI2NDIxMjY1fQ.wCZcQ5uSQXnVgS_ZGyzjl6TOQk8rflfe2HSxSku0Aj4",
|
||||
@@ -312,7 +312,7 @@ db.users.insertMany([
|
||||
},
|
||||
{
|
||||
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI3NjQwNTgwfQ.YdB5unWwaZ21kk87RRPolLGiWxf7bKX0piKd-bGQifU",
|
||||
"_id": ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||
"_id": new ObjectId("66e73f04ac95a84fd0e122ae"),
|
||||
"access": "auth",
|
||||
"browser": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Mobile Safari/537.36",
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiJQUk9WQU1TR0AxQSIsInNtYXJ0IjoiNjZlNmZiNWFhYzk1YTg0ZmQwZTExODgxIiwiYWNjZXNzIjoiYXV0aCIsInVuIjoiRW56byIsImlhdCI6MTcyNjQzMDk4MCwiZXhwIjoxNzI2NDM4MTgwfQ.TMF1UNbgw-EpGVWWDNnY3wRdLYOyp5HzAQiakpyaL_4",
|
||||
|
||||
@@ -13,6 +13,6 @@ fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
echo "Sincronizzazione di 1 FILE in corso..."
|
||||
rsync -avz -e 'ssh -p 8855' src/server/tools/general.js suryapaolo@servereng:/var/www/$SERVERDIR_WEBSITE/src/server/tools/general.js
|
||||
rsync -avz -e 'ssh -p 8855' src/server/tools/general.js suryapaolo@servereng:$SERVERDIR_WEBSITE/src/server/tools/general.js
|
||||
echo "Sincronizzazione TERMINATA - SERVER PRODUZIONE!"
|
||||
fi
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.prod.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"admin_scripts"
|
||||
"sass"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file .env.production ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
.env.prod.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.production"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
ecosystem.config.pcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER PCB! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.test.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"admin_scripts"
|
||||
"sass"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file .env.test ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
.env.test.pcb "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/.env.test"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file ecosystem.config.testpcb.js in ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
ecosystem.config.testpcb.js "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER PCB TEST! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
82
deploynode_pcb_prod.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.prod.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
msg="*** SERVER DI PRODUZIONE PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
|
||||
CONFIG_JS="ecosystem.config.pcb_prod.js"
|
||||
ENV_FILE=".env.prod.pcb"
|
||||
ENV_OUT=".env.production"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"admin_scripts"
|
||||
"sass"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file .env.production ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER PCB PRODUZIONE! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
fi
|
||||
82
deploynode_pcb_test.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.test.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
msg="*** SERVER DI TEST PCB **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
echo "Sincronizzazione in corso PCB TEST ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
|
||||
CONFIG_JS="ecosystem.config.pcb_test.js"
|
||||
ENV_FILE=".env.test.pcb"
|
||||
ENV_OUT=".env.test"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"admin_scripts"
|
||||
"sass"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file .env.test ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER PCB TEST! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
fi
|
||||
77
deploynode_riso_prod.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.prod.riso
|
||||
|
||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
msg="*** SERVER DI ### PRODUZIONE ### RISO **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
CONFIG_JS="ecosystem.config.riso_prod.js"
|
||||
ENV_FILE=".env.prod.riso"
|
||||
ENV_OUT=".env.production"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"sass"
|
||||
"admin_scripts"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||
else
|
||||
echo "❌ Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
fi
|
||||
86
deploynode_riso_test.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.test.risosrv
|
||||
|
||||
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||
echo ""
|
||||
|
||||
msg="*** SERVER DI ### TEST ### RISO **** INVIARE GLI AGGIORNAMENTI ? (Y/N)"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
# Configurazione
|
||||
REMOTE_USER="pcbuser"
|
||||
REMOTE_HOST="pcb"
|
||||
REMOTE_PORT="8822"
|
||||
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||
CONFIG_JS="ecosystem.config.riso_test.js"
|
||||
ENV_FILE=".env.test.risosrv"
|
||||
ENV_OUT=".env.test"
|
||||
|
||||
#ENV_FILE=".env.prod.pcb"
|
||||
#ENV_OUT=".env.production"
|
||||
|
||||
# Array di cartelle e file da sincronizzare
|
||||
SYNC_ITEMS=(
|
||||
"css"
|
||||
"docs"
|
||||
"emails"
|
||||
"plugins"
|
||||
"sass"
|
||||
"admin_scripts"
|
||||
"src"
|
||||
)
|
||||
|
||||
echo $REMOTE_DIR
|
||||
|
||||
echo ""
|
||||
echo "*** Copia Cartelle ... "
|
||||
|
||||
|
||||
# Esegui rsync per le cartelle
|
||||
rsync -avz --delete \
|
||||
--exclude='src/server/router/upload/' \
|
||||
-e "ssh $SSH_OPTIONS" \
|
||||
"${SYNC_ITEMS[@]}" \
|
||||
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
||||
|
||||
# Sincronizza i file specifici
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file package.json ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
echo ""
|
||||
echo "*** Copia del file $CONFIG_JS in ecosystem.config.js ... "
|
||||
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||
$CONFIG_JS "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||
|
||||
|
||||
# Verifica il risultato
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||
else
|
||||
echo "Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source ./.env.test2
|
||||
|
||||
echo "Directory attuale: $PWD"
|
||||
|
||||
msg="*** SERVER DI TEST2 **** SEI SICURO DI INVIARE GLI AGGIORNAMENTI SERVERSIDE (NODE JS) - SUL SERVER $SERVERDIR_WEBSITE (Y/N) ? "
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
read -p "$msg" risposta
|
||||
else
|
||||
echo $msg
|
||||
risposta=$1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [[ $risposta == "Y" || $risposta == "y" ]]; then
|
||||
|
||||
echo "Sincronizzazione in corso... $SERVERDIR_WEBSITE"
|
||||
echo "Copiando .env.test2..."
|
||||
rsync -avz -e 'ssh -p 8855' .env.test2 suryapaolo@servereng:/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/aaa.js
Normal file
38
docs/aaa.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"id": "70606",
|
||||
"title": "Grande Libro dell'Autosufficienza - 50 anni - Nuovo",
|
||||
"description": "<em><strong>\"Il Grande Libro dell\u2019Autosufficienza\"<\/strong><\/em> di John Seymour \u00e8 un manuale completo che celebra 50 anni di pratiche di <strong>autosufficienza<\/strong> e <strong>sostenibilit\u00e0<\/strong>. Il libro offre insegnamenti pratici su come creare e gestire un <strong>orto biologico<\/strong>, raccogliere e conservare i raccolti, produrre <strong>energia rinnovabile<\/strong>, allevare animali e ridurre i rifiuti. Seymour ci guida passo passo in un viaggio verso una vita in armonia con la natura, promuovendo l\u2019indipendenza e la sostenibilit\u00e0. Un testo imprescindibile per chi desidera riscoprire le tradizioni agricole e applicarle per vivere in modo pi\u00f9 <strong>sostenibile<\/strong> e <strong>autonomo<\/strong>.\r\n<h2><strong>Con questo libro scoprirai<\/strong>:<\/h2>\r\n<ul>\r\n \t<li>Come <strong>coltivare un orto biologico<\/strong> e ottenere cibo sano.<\/li>\r\n \t<li>Le tecniche per <strong>conservare il raccolto<\/strong> e ottimizzare le risorse naturali.<\/li>\r\n \t<li>Come allevare animali per ottenere cibo e altri prodotti.<\/li>\r\n \t<li>Come produrre <strong>energia rinnovabile<\/strong> e ridurre l\u2019impatto ambientale.<\/li>\r\n \t<li>L\u2019arte di <strong>ridurre e riciclare<\/strong> rifiuti, promuovendo uno stile di vita pi\u00f9 sostenibile.<\/li>\r\n<\/ul>\r\n<h2><strong>Domande cruciali a cui <em>\"Il Grande Libro dell\u2019Autosufficienza\"<\/em> risponde<\/strong>:<\/h2>\r\n<ul>\r\n \t<li>Come posso vivere in modo <strong>autosufficiente<\/strong> e ridurre la mia dipendenza dalle risorse esterne?<\/li>\r\n \t<li>Quali sono le migliori tecniche per <strong>coltivare un orto biologico<\/strong> e garantire un raccolto abbondante?<\/li>\r\n \t<li>Come posso <strong>conservare il raccolto<\/strong> in modo naturale e duraturo?<\/li>\r\n \t<li>In che modo posso <strong>produrre energia rinnovabile<\/strong> a casa mia?<\/li>\r\n \t<li>Come posso vivere in <strong>armonia con la natura<\/strong> e promuovere la <strong>sostenibilit\u00e0<\/strong>?<\/li>\r\n<\/ul>\r\n<h2><strong>Questo libro \u00e8 dedicato a<\/strong>:<\/h2>\r\n<ul>\r\n \t<li>Lettori appassionati di <strong>giardinaggio<\/strong>, <strong>agricoltura biologica<\/strong> e vita rurale.<\/li>\r\n \t<li>Chiunque desideri adottare uno <strong>stile di vita sostenibile<\/strong> e autosufficiente.<\/li>\r\n \t<li><strong>Famiglie eco-consapevoli<\/strong> che vogliono ridurre il proprio impatto ambientale.<\/li>\r\n \t<li><strong>Amanti della natura<\/strong> e sostenitori delle <strong>energie rinnovabili<\/strong>.<\/li>\r\n<\/ul>\r\n<h2><strong>Contenuti chiave <em>\"Il Grande Libro dell\u2019Autosufficienza\"<\/em><\/strong>:<\/h2>\r\n<em>Il Grande Libro dell\u2019Autosufficienza<\/em> offre una panoramica completa di tutte le tecniche per vivere in modo <strong>autonomo<\/strong> e <strong>sostenibile<\/strong>. Attraverso 10 capitoli, il libro esplora vari aspetti dell\u2019autosufficienza, dalla coltivazione di ortaggi e frutti alla produzione di cibo dagli animali, fino alla gestione dell'energia e dei rifiuti. La guida si focalizza sul valore delle <strong>tradizioni agricole<\/strong>, sulla cura dell\u2019ambiente e sul benessere che deriva dal vivere in sintonia con la natura.\r\n\r\n ",
|
||||
"link": "https:\/\/www.fioredellavita.it\/grande-libro-dellautosufficienza-50-anni\/?attribute_pa_versione=nuovo",
|
||||
"image_link": "https:\/\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/il-grande-libro-dell-autosufficienza-speciale-50-anni-copertina-web.jpg",
|
||||
"price": "39,00",
|
||||
"sale_price": "37,05",
|
||||
"categories": "Informazione Libera",
|
||||
"isbn": "",
|
||||
"Autore": "John,Seymour",
|
||||
"Editore": "Macro Edizioni",
|
||||
"Tipologia": "Libri",
|
||||
"Collezione": "Libri Informazione Libera,Informazione Libera",
|
||||
"Quantita": "1821",
|
||||
"Lunghezza": "",
|
||||
"Stato": "publish",
|
||||
"Pagine": "",
|
||||
"Edizione": "",
|
||||
"Traduzione": "",
|
||||
"Versione": "Nuovo",
|
||||
"StockStatus": "instock",
|
||||
"downloadable": "no",
|
||||
"img1": "https:\/\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/quarta_nuovo_grande_libro_dell_autosufficienza_2024_17038.jpg",
|
||||
"img2": "",
|
||||
"img3": "",
|
||||
"formato": "Cartonato",
|
||||
"preOrderDate": "2025-02-25",
|
||||
"short_descr": null,
|
||||
"availability": "in stock",
|
||||
"checkout_link": "https:\/\/www.fioredellavita.it\/carrello\/?productId=70606",
|
||||
"seo_descr": "Versione: Nuovo",
|
||||
"preord": "no",
|
||||
"addtocart_link": "https:\/\/www.fioredellavita.it\/grande-libro-dellautosufficienza-50-anni\/?attribute_pa_versione=nuovo&variation_id=70606&add-to-cart=70606",
|
||||
"eta": "",
|
||||
"misure": "cm 22x28",
|
||||
"sku": "22464"
|
||||
},
|
||||
36
docs/apache2/contatti.htm
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- wp:themify-builder/canvas /-->
|
||||
|
||||
<!--themify_builder_static-->
|
||||
<h3>Contattaci</h3>
|
||||
<p><strong>Hai domande, consigli o suggerimenti da proporci?</strong><br />Inviaci un messaggio attraverso il form qui
|
||||
sotto!</p>
|
||||
<form action="https://www.fioredellavita.it/wp-admin/admin-ajax.php" class="builder-contact" id="tb_th9k520-form"
|
||||
method="post" data-post-id="0" data-element-id="th9k520" data-orig-id=""> <label for="field_extra_tb_th9k520_0">
|
||||
Invia a: <input type="hidden" name="field_extra_name_0" value="Invia a:"> * </label> <select
|
||||
id="field_extra_tb_th9k520_0" name="field_extra_0" required>
|
||||
<option value="Seleziona destinatario"> Seleziona destinatario </option>
|
||||
<option value="ordiniweb@gruppomacro.com"> ordiniweb@gruppomacro.com </option>
|
||||
</select> <label for="tb_th9k520-contact-subject">Oggetto richiesta: *</label> <input type="text"
|
||||
name="contact-subject" placeholder="" id="tb_th9k520-contact-subject" value="" required> <label
|
||||
for="tb_th9k520-contact-name">Nome *</label> <input type="text" name="contact-name" placeholder=""
|
||||
id="tb_th9k520-contact-name" value="" required> <label for="field_extra_tb_th9k520_1"> Cognome <input
|
||||
type="hidden" name="field_extra_name_1" value="Cognome"> * </label> <input type="text" name="field_extra_1"
|
||||
id="field_extra_tb_th9k520_1" placeholder="" required> <label for="tb_th9k520-contact-email">E-mail *</label>
|
||||
<input type="text" name="contact-email" placeholder="" id="tb_th9k520-contact-email" value="" required> <label
|
||||
for="field_extra_tb_th9k520_2"> Telefono <input type="hidden" name="field_extra_name_2" value="Telefono">
|
||||
</label> <input type="tel" name="field_extra_2" id="field_extra_tb_th9k520_2" placeholder=""> <label
|
||||
for="tb_th9k520-contact-message">Descrivi la tua richiesta: </label> <textarea name="contact-message"
|
||||
placeholder="" id="tb_th9k520-contact-message"></textarea> <label> <input type="checkbox" name="gdpr" value="1"
|
||||
required> Ho letto l'Informativa sulla privacy nella pagina <a href="/contatti"> Privacy Policy</a> del Sito
|
||||
e acconsento al trattamento dei dati inseriti. * </label> <label> Verifica antispam * </label> <button
|
||||
type="submit">Invia</button> </form>
|
||||
<h3>Dove siamo</h3>
|
||||
<p><strong>Macro Società Cooperativa srl</strong><br />Via Giardino, 30 – 47522 – Cesena (FC)</p>
|
||||
<p>Fai click sulla mappa (OpenStreetMap) per trovare il percorso dal tuo indirizzo.</p>
|
||||
<a
|
||||
href="https://www.openstreetmap.org/search?query=Via%20Giardino%2C%2030%20%E2%80%93%2047522%20%E2%80%93%20Cesena%20(FC)#map=16/44.1525/12.2062">
|
||||
<img decoding="async" loading="lazy" width="500" height="499"
|
||||
src="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg" title="mappa-macro"
|
||||
alt="mappa-macro"
|
||||
srcset="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg 500w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-300x300.jpg 300w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-150x150.jpg 150w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-320x319.jpg 320w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-100x100.jpg 100w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-50x50.jpg 50w"
|
||||
sizes="(max-width: 500px) 100vw, 500px" /> </a><!--/themify_builder_static-->
|
||||
429
docs/libro1.htm
Normal file
@@ -0,0 +1,429 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22467 -->
|
||||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Link Page</title>
|
||||
<style>
|
||||
#loading {
|
||||
display: none;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid #f3f3f3;
|
||||
border-top: 5px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Links</h1>
|
||||
<form id="articleForm">
|
||||
<pre> Per vedere la lista -> "LIBRI IN PREVENDITA"
|
||||
in <span style="color: green;">VERDE</span> quelli in PreOrdine
|
||||
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
|
||||
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
|
||||
</pre>
|
||||
<label for="article_id">ID Articolo or Ordine:</label>
|
||||
<input type="text" id="article_id" name="id" value="22467">
|
||||
<input type="text" id="action" name="action" value="" hidden="">
|
||||
<br>
|
||||
<button type="button" data-action="search">Cerca Articolo</button>
|
||||
<button type="button" data-action="search_isbn">Cerca ISBN</button>
|
||||
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
|
||||
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
|
||||
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
|
||||
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
|
||||
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
|
||||
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
|
||||
<br><br>
|
||||
|
||||
<button type="button" data-action="showTest">Test</button>
|
||||
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
|
||||
<button type="button" data-action="cartolibri">Cartolibri</button>
|
||||
<button type="button" data-action="riviste">Riviste</button>
|
||||
<button type="button" data-action="showOrdini">Mostra Ordini</button>
|
||||
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
|
||||
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
|
||||
<button type="button" data-action="Vendite">Vendite</button>
|
||||
|
||||
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
|
||||
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
|
||||
</form>
|
||||
<div>
|
||||
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
|
||||
|
||||
</div>
|
||||
<div id="result">Articles di 22467 :
|
||||
<pre>[
|
||||
{
|
||||
"Id": "258787",
|
||||
"IdArticolo": "22467",
|
||||
"Ean13": "9788828510147",
|
||||
"Titolo": "Le Stelle Cadranno dal Cielo?",
|
||||
"ListaAutori": "17",
|
||||
"ListaArgomenti": "9",
|
||||
"IdStatoProdotto": "34",
|
||||
"PrezzoIvato": "24.9000",
|
||||
"IdMarchioEditoriale": "1",
|
||||
"IdCollana": "73",
|
||||
"DataPubblicazione": "2025-01-14 00:00:00.000",
|
||||
"IdTipologia": "1",
|
||||
"IdTipoFormato": "1",
|
||||
"Misure": "cm 13,5x20,5",
|
||||
"Pagine": "192",
|
||||
"Sottotitolo": "Non \u00e8 una catastrofe ma la Rivelazione dell'Universo reale",
|
||||
"Durata": "",
|
||||
"Numero": "",
|
||||
"Edizione": "Dicembre 2024",
|
||||
"Ristampa": "",
|
||||
"DataInizioCampagna": "2024-11-07 00:00:00.000",
|
||||
"DataFineCampagna": "2099-12-31 00:00:00.000",
|
||||
"ScontoCampagna": "5.00",
|
||||
"PrezzoIvatoScontatoCampagna": "23.6550",
|
||||
"DataOra": "2024-12-19 09:24:01.593",
|
||||
"Enabled": "0",
|
||||
"IDTagGruppo": "0",
|
||||
"Utente": "FLANZA-NOTE",
|
||||
"PercIva": ".00",
|
||||
"IdTitoloOriginale": "13415",
|
||||
"EnabledAlFresco": "1",
|
||||
"CodEdizione": "16",
|
||||
"FasciaEta": null,
|
||||
"FasciaEta2": null,
|
||||
"data": "2024-12-19 09:24:01.593",
|
||||
"DescrizioneStatoProdotto": "In prevendita",
|
||||
"Codice": "22467",
|
||||
"QtaDisponibile": "-6"
|
||||
}
|
||||
]</pre>Product:
|
||||
<pre>{
|
||||
"id": 74617,
|
||||
"name": "Le stelle cadranno dal cielo? - Nuovo",
|
||||
"slug": "le-stelle-cadranno-dal-cielo-nuovo",
|
||||
"permalink": "https:\/\/www.fioredellavita.it\/le-stelle-cadranno-dal-cielo\/?attribute_pa_versione=nuovo",
|
||||
"date_created": "2024-12-19T15:26:11",
|
||||
"date_created_gmt": "2024-12-19T14:26:11",
|
||||
"date_modified": "2024-12-20T13:02:31",
|
||||
"date_modified_gmt": "2024-12-20T12:02:31",
|
||||
"type": "variation",
|
||||
"status": "publish",
|
||||
"featured": false,
|
||||
"catalog_visibility": "visible",
|
||||
"description": "",
|
||||
"short_description": "",
|
||||
"sku": "22467",
|
||||
"price": "23.6550",
|
||||
"regular_price": "24.9000",
|
||||
"sale_price": "23.6550",
|
||||
"date_on_sale_from": "2024-11-07T00:00:00",
|
||||
"date_on_sale_from_gmt": "2024-11-06T23:00:00",
|
||||
"date_on_sale_to": "2099-12-31T23:59:59",
|
||||
"date_on_sale_to_gmt": "2099-12-31T22:59:59",
|
||||
"on_sale": true,
|
||||
"purchasable": true,
|
||||
"total_sales": "0",
|
||||
"virtual": false,
|
||||
"downloadable": false,
|
||||
"downloads": [],
|
||||
"download_limit": -1,
|
||||
"download_expiry": -1,
|
||||
"external_url": "",
|
||||
"button_text": "",
|
||||
"tax_status": "taxable",
|
||||
"tax_class": "",
|
||||
"manage_stock": true,
|
||||
"stock_quantity": 10000,
|
||||
"backorders": "no",
|
||||
"backorders_allowed": false,
|
||||
"backordered": false,
|
||||
"low_stock_amount": null,
|
||||
"sold_individually": false,
|
||||
"weight": "",
|
||||
"dimensions": {
|
||||
"length": "",
|
||||
"width": "",
|
||||
"height": ""
|
||||
},
|
||||
"shipping_required": true,
|
||||
"shipping_taxable": true,
|
||||
"shipping_class": "",
|
||||
"shipping_class_id": 0,
|
||||
"reviews_allowed": false,
|
||||
"average_rating": "0.00",
|
||||
"rating_count": 0,
|
||||
"upsell_ids": [],
|
||||
"cross_sell_ids": [],
|
||||
"parent_id": 70642,
|
||||
"purchase_note": "",
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"images": [
|
||||
{
|
||||
"id": 73623,
|
||||
"date_created": "2024-11-20T11:12:29",
|
||||
"date_created_gmt": "2024-11-20T09:12:29",
|
||||
"date_modified": "2024-12-20T14:02:31",
|
||||
"date_modified_gmt": "2024-12-20T12:02:31",
|
||||
"src": "https:\/\/i0.wp.com\/www.fioredellavita.it\/wp-content\/uploads\/2024\/09\/le-stella-cadranno-dal-cielo-copertina-web.jpg?fit=450%2C624&ssl=1",
|
||||
"name": "le-stella-cadranno-dal-cielo-copertina-web",
|
||||
"alt": "\"Le stelle cadranno dal cielo?\""
|
||||
}
|
||||
],
|
||||
"attributes": [
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Versione",
|
||||
"slug": "pa_versione",
|
||||
"option": "Nuovo"
|
||||
}
|
||||
],
|
||||
"default_attributes": [],
|
||||
"variations": [],
|
||||
"grouped_products": [],
|
||||
"menu_order": 0,
|
||||
"price_html": "<del aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>24,90<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/del> <span class="\"screen-reader-text\"">Il prezzo originale era: 24,90€.<\/span><ins aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>23,66<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/ins><span class="\"screen-reader-text\"">Il prezzo attuale \u00e8: 23,66€.<\/span>",
|
||||
"related_ids": [],
|
||||
"meta_data": [
|
||||
{
|
||||
"id": 1521527,
|
||||
"key": "ISBN",
|
||||
"value": "9788828510147"
|
||||
},
|
||||
{
|
||||
"id": 1521528,
|
||||
"key": "misure",
|
||||
"value": "cm 13,5x20,5"
|
||||
},
|
||||
{
|
||||
"id": 1521529,
|
||||
"key": "formato",
|
||||
"value": "Brossura"
|
||||
},
|
||||
{
|
||||
"id": 1521530,
|
||||
"key": "pagine",
|
||||
"value": "192"
|
||||
},
|
||||
{
|
||||
"id": 1521531,
|
||||
"key": "edizione",
|
||||
"value": "Dicembre 2024"
|
||||
},
|
||||
{
|
||||
"id": 1521532,
|
||||
"key": "DataPubblicazione",
|
||||
"value": "1736809200"
|
||||
},
|
||||
{
|
||||
"id": 1521533,
|
||||
"key": "DataPubbStr",
|
||||
"value": "14\/01\/2025"
|
||||
},
|
||||
{
|
||||
"id": 1521535,
|
||||
"key": "_wpro_variable_is_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521536,
|
||||
"key": "_is_pre_order",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521537,
|
||||
"key": "_pre_order_date",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521538,
|
||||
"key": "_wpro_date_label_variable",
|
||||
"value": "Prenotalo per riceverlo entro il 14 gennaio 2025"
|
||||
},
|
||||
{
|
||||
"id": 1521539,
|
||||
"key": "_wpro_no_date_label_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521540,
|
||||
"key": "_wpro_manage_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521541,
|
||||
"key": "_wpro_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521542,
|
||||
"key": "_wpro_label_variable",
|
||||
"value": "Pre Ordinalo!"
|
||||
},
|
||||
{
|
||||
"id": 1521543,
|
||||
"key": "_wpro_price_type_variable",
|
||||
"value": "manual"
|
||||
},
|
||||
{
|
||||
"id": 1521544,
|
||||
"key": "_wpro_amount_price_variable",
|
||||
"value": "fixed"
|
||||
},
|
||||
{
|
||||
"id": 1521545,
|
||||
"key": "_wpro_date_variable",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521546,
|
||||
"key": "_wpro_time_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521547,
|
||||
"key": "_rank_math_gtin_code",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521680,
|
||||
"key": "_ywpo_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521681,
|
||||
"key": "_ywpo_availability_date_mode",
|
||||
"value": "date"
|
||||
},
|
||||
{
|
||||
"id": 1521682,
|
||||
"key": "_ywpo_for_sale_date",
|
||||
"value": "2025-01-14"
|
||||
},
|
||||
{
|
||||
"id": 1521683,
|
||||
"key": "_ywpo_price_mode",
|
||||
"value": "default"
|
||||
},
|
||||
{
|
||||
"id": 1521684,
|
||||
"key": "_ywpo_preorder_price",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"id": 1521685,
|
||||
"key": "_ywpo_preorder_discount_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521686,
|
||||
"key": "_ywpo_preorder_discount_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521687,
|
||||
"key": "_ywpo_preorder_increase_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521688,
|
||||
"key": "_ywpo_preorder_increase_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521711,
|
||||
"key": "woo_feed_availability_date_var",
|
||||
"value": "2025-01-14"
|
||||
}
|
||||
],
|
||||
"stock_status": "instock",
|
||||
"has_options": false,
|
||||
"post_password": "",
|
||||
"global_unique_id": "",
|
||||
"jetpack_sharing_enabled": true,
|
||||
"jetpack-related-posts": [],
|
||||
"builder_content": "",
|
||||
"_links": {
|
||||
"self": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/74617",
|
||||
"targetHints": {
|
||||
"allow": [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"collection": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
|
||||
}
|
||||
],
|
||||
"up": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/70642"
|
||||
}
|
||||
]
|
||||
}
|
||||
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
|
||||
<div id="loading" style="display: none;"></div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('articleForm');
|
||||
const result = document.getElementById('result');
|
||||
const loading = document.getElementById('loading');
|
||||
|
||||
const buttons = form.querySelectorAll('button');
|
||||
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
|
||||
|
||||
function handleButtonClick(event) {
|
||||
let action = event.target.dataset.action;
|
||||
let id = '0';
|
||||
try {
|
||||
id = form.querySelector('input[name="id"]').value;
|
||||
if (!action) {
|
||||
action = form.querySelector('input[name="action"]').value;
|
||||
}
|
||||
} catch (e) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
loading.style.display = 'block'; // Mostra la clessidra
|
||||
|
||||
let baseUrl = window.location.href;
|
||||
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
|
||||
|
||||
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
result.innerHTML = data;
|
||||
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>
|
||||
403
docs/libro2.htm
Normal file
@@ -0,0 +1,403 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- saved from url=(0067)http://vps-88271abb.vps.ovh.net/apimacro/public/mylinkspao?id=22753 -->
|
||||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Link Page</title>
|
||||
<style>
|
||||
#loading {
|
||||
display: none;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border: 5px solid #f3f3f3;
|
||||
border-top: 5px solid #3498db;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Links</h1>
|
||||
<form id="articleForm">
|
||||
<pre> Per vedere la lista -> "LIBRI IN PREVENDITA"
|
||||
in <span style="color: green;">VERDE</span> quelli in PreOrdine
|
||||
in <span style="color: red;">ROSSO</span> quelli ancora non abilitati.
|
||||
cliccare sul link <span style="font-weight: bold;">Imposta in PREORDINE"</span> per abilitarlo.
|
||||
</pre>
|
||||
<label for="article_id">ID Articolo or Ordine:</label>
|
||||
<input type="text" id="article_id" name="id" value="22753">
|
||||
<input type="text" id="action" name="action" value="" hidden="">
|
||||
<br>
|
||||
<button type="button" data-action="search">Cerca Articolo</button>
|
||||
<button type="button" data-action="search_isbn">Cerca ISBN</button>
|
||||
<button type="button" data-action="updateArtFromGM">Aggiorna Articolo da GM</button>
|
||||
<button type="button" data-action="checkPrevendita">E' in PreVendita?</button>
|
||||
<button type="button" data-action="setPreOrder">Impostalo in PreVendita!</button>
|
||||
<button type="button" data-action="setDataPubblicazione">Aggiorna Data Pubblicazione</button>
|
||||
<button type="button" data-action="showDettSingleOrdine">Dett. Ordine</button>
|
||||
<button type="button" data-action="showDettSingleOrdineWeb">Dett. Ordine Web</button>
|
||||
<br><br>
|
||||
|
||||
<button type="button" data-action="showTest">Test</button>
|
||||
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
|
||||
<button type="button" data-action="cartolibri">Cartolibri</button>
|
||||
<button type="button" data-action="riviste">Riviste</button>
|
||||
<button type="button" data-action="showOrdini">Mostra Ordini</button>
|
||||
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
|
||||
<button type="button" data-action="showArticoliFatturatiWeb">Mostra Fatturati</button>
|
||||
<button type="button" data-action="Vendite">Vendite</button>
|
||||
|
||||
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
|
||||
<button type="button" data-action="showDettOrdiniWeb">Dettaglio Ordini Web</button>
|
||||
</form>
|
||||
<div>
|
||||
<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-articles-sales" target="_blank">Vedi Articoli Venduti e Fatturati</a> - <a href="http://vps-88271abb.vps.ovh.net/apimacro/public/export-articles-sales-json" target="_blank">(Esporta)</a><br>
|
||||
|
||||
</div>
|
||||
<div id="result">Articles di 22753 :
|
||||
<pre>[
|
||||
{
|
||||
"Id": "258799",
|
||||
"IdArticolo": "22753",
|
||||
"Ean13": "9788865934883",
|
||||
"Titolo": "La Storia di Flumeide e la Bambina",
|
||||
"ListaAutori": "4184",
|
||||
"ListaArgomenti": "6",
|
||||
"IdStatoProdotto": "34",
|
||||
"PrezzoIvato": "13.0000",
|
||||
"IdMarchioEditoriale": "34",
|
||||
"IdCollana": "1033",
|
||||
"DataPubblicazione": "2025-01-21 00:00:00.000",
|
||||
"IdTipologia": "1",
|
||||
"IdTipoFormato": "1",
|
||||
"Misure": "cm 28x19",
|
||||
"Pagine": "32",
|
||||
"Sottotitolo": "Una fiaba per grandi",
|
||||
"Durata": "",
|
||||
"Numero": "",
|
||||
"Edizione": "Gennaio 2025",
|
||||
"Ristampa": "",
|
||||
"DataInizioCampagna": "2024-11-15 00:00:00.000",
|
||||
"DataFineCampagna": "2099-11-15 00:00:00.000",
|
||||
"ScontoCampagna": "5.00",
|
||||
"PrezzoIvatoScontatoCampagna": "12.3500",
|
||||
"DataOra": "2024-12-19 11:16:13.993",
|
||||
"Enabled": "0",
|
||||
"IDTagGruppo": "0",
|
||||
"Utente": "AZANGHERI-NOTE",
|
||||
"PercIva": ".00",
|
||||
"IdTitoloOriginale": "13664",
|
||||
"EnabledAlFresco": "1",
|
||||
"CodEdizione": "1",
|
||||
"FasciaEta": "Genitori",
|
||||
"FasciaEta2": "Ragazze e ragazzi",
|
||||
"data": "2024-12-19 11:16:13.993",
|
||||
"DescrizioneStatoProdotto": "In prevendita",
|
||||
"Codice": "22753",
|
||||
"QtaDisponibile": "-2"
|
||||
}
|
||||
]</pre>Product:
|
||||
<pre>{
|
||||
"id": 73612,
|
||||
"name": "La storia di Flumeide e la bambina - Nuovo",
|
||||
"slug": "la-storia-di-flumeide-e-la-bambina-nuovo",
|
||||
"permalink": "https:\/\/www.fioredellavita.it\/?post_type=product&p=73611&attribute_pa_versione=nuovo",
|
||||
"date_created": "2024-11-20T04:49:10",
|
||||
"date_created_gmt": "2024-11-20T03:49:10",
|
||||
"date_modified": "2024-12-20T12:56:24",
|
||||
"date_modified_gmt": "2024-12-20T11:56:24",
|
||||
"type": "variation",
|
||||
"status": "publish",
|
||||
"featured": false,
|
||||
"catalog_visibility": "visible",
|
||||
"description": "",
|
||||
"short_description": "",
|
||||
"sku": "22753",
|
||||
"price": "12.3500",
|
||||
"regular_price": "13.0000",
|
||||
"sale_price": "12.3500",
|
||||
"date_on_sale_from": "2024-11-15T00:00:00",
|
||||
"date_on_sale_from_gmt": "2024-11-14T23:00:00",
|
||||
"date_on_sale_to": "2099-11-15T23:59:59",
|
||||
"date_on_sale_to_gmt": "2099-11-15T22:59:59",
|
||||
"on_sale": true,
|
||||
"purchasable": true,
|
||||
"total_sales": "0",
|
||||
"virtual": false,
|
||||
"downloadable": false,
|
||||
"downloads": [],
|
||||
"download_limit": -1,
|
||||
"download_expiry": -1,
|
||||
"external_url": "",
|
||||
"button_text": "",
|
||||
"tax_status": "taxable",
|
||||
"tax_class": "",
|
||||
"manage_stock": true,
|
||||
"stock_quantity": 10000,
|
||||
"backorders": "no",
|
||||
"backorders_allowed": false,
|
||||
"backordered": false,
|
||||
"low_stock_amount": null,
|
||||
"sold_individually": false,
|
||||
"weight": "",
|
||||
"dimensions": {
|
||||
"length": "",
|
||||
"width": "",
|
||||
"height": ""
|
||||
},
|
||||
"shipping_required": true,
|
||||
"shipping_taxable": true,
|
||||
"shipping_class": "",
|
||||
"shipping_class_id": 0,
|
||||
"reviews_allowed": false,
|
||||
"average_rating": "0.00",
|
||||
"rating_count": 0,
|
||||
"upsell_ids": [],
|
||||
"cross_sell_ids": [],
|
||||
"parent_id": 73611,
|
||||
"purchase_note": "",
|
||||
"categories": [],
|
||||
"tags": [],
|
||||
"images": [],
|
||||
"attributes": [
|
||||
{
|
||||
"id": 6,
|
||||
"name": "Versione",
|
||||
"slug": "pa_versione",
|
||||
"option": "Nuovo"
|
||||
}
|
||||
],
|
||||
"default_attributes": [],
|
||||
"variations": [],
|
||||
"grouped_products": [],
|
||||
"menu_order": 1,
|
||||
"price_html": "<del aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>13,00<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/del> <span class="\"screen-reader-text\"">Il prezzo originale era: 13,00€.<\/span><ins aria-hidden="\"true\""><span class="\"woocommerce-Price-amount" amount\"=""><bdi>12,35<span class="\"woocommerce-Price-currencySymbol\"">€<\/span><\/bdi><\/span><\/ins><span class="\"screen-reader-text\"">Il prezzo attuale \u00e8: 12,35€.<\/span>",
|
||||
"related_ids": [],
|
||||
"meta_data": [
|
||||
{
|
||||
"id": 1501793,
|
||||
"key": "ISBN",
|
||||
"value": "9788865934883"
|
||||
},
|
||||
{
|
||||
"id": 1501794,
|
||||
"key": "misure",
|
||||
"value": "cm 28x19"
|
||||
},
|
||||
{
|
||||
"id": 1501795,
|
||||
"key": "formato",
|
||||
"value": "Brossura"
|
||||
},
|
||||
{
|
||||
"id": 1501796,
|
||||
"key": "pagine",
|
||||
"value": "32"
|
||||
},
|
||||
{
|
||||
"id": 1501798,
|
||||
"key": "_wpro_variable_is_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1501799,
|
||||
"key": "_is_pre_order",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521636,
|
||||
"key": "_pre_order_date",
|
||||
"value": "2025-01-21"
|
||||
},
|
||||
{
|
||||
"id": 1521637,
|
||||
"key": "_wpro_date_label_variable",
|
||||
"value": "Prenotalo per riceverlo entro il 21 gennaio 2025"
|
||||
},
|
||||
{
|
||||
"id": 1521638,
|
||||
"key": "_wpro_no_date_label_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521639,
|
||||
"key": "_wpro_manage_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521640,
|
||||
"key": "_wpro_price_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521641,
|
||||
"key": "_wpro_label_variable",
|
||||
"value": "Pre Ordinalo!"
|
||||
},
|
||||
{
|
||||
"id": 1521642,
|
||||
"key": "_wpro_price_type_variable",
|
||||
"value": "manual"
|
||||
},
|
||||
{
|
||||
"id": 1521643,
|
||||
"key": "_wpro_amount_price_variable",
|
||||
"value": "fixed"
|
||||
},
|
||||
{
|
||||
"id": 1521644,
|
||||
"key": "_wpro_date_variable",
|
||||
"value": "2025-01-21"
|
||||
},
|
||||
{
|
||||
"id": 1521645,
|
||||
"key": "_wpro_time_variable",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521646,
|
||||
"key": "_rank_math_gtin_code",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521698,
|
||||
"key": "_ywpo_preorder",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"id": 1521699,
|
||||
"key": "_ywpo_availability_date_mode",
|
||||
"value": "date"
|
||||
},
|
||||
{
|
||||
"id": 1521700,
|
||||
"key": "_ywpo_for_sale_date",
|
||||
"value": "1736809200"
|
||||
},
|
||||
{
|
||||
"id": 1521701,
|
||||
"key": "_ywpo_price_mode",
|
||||
"value": "default"
|
||||
},
|
||||
{
|
||||
"id": 1521702,
|
||||
"key": "_ywpo_preorder_price",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"id": 1521703,
|
||||
"key": "_ywpo_preorder_discount_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521704,
|
||||
"key": "_ywpo_preorder_discount_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521705,
|
||||
"key": "_ywpo_preorder_increase_percentage",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521706,
|
||||
"key": "_ywpo_preorder_increase_fixed",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"id": 1521707,
|
||||
"key": "edizione",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"stock_status": "instock",
|
||||
"has_options": false,
|
||||
"post_password": "",
|
||||
"global_unique_id": "",
|
||||
"jetpack_sharing_enabled": true,
|
||||
"jetpack-related-posts": [],
|
||||
"builder_content": "",
|
||||
"_links": {
|
||||
"self": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73612",
|
||||
"targetHints": {
|
||||
"allow": [
|
||||
"GET",
|
||||
"POST",
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"collection": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products"
|
||||
}
|
||||
],
|
||||
"up": [
|
||||
{
|
||||
"href": "https:\/\/www.fioredellavita.it\/wp-json\/wc\/v3\/products\/73611"
|
||||
}
|
||||
]
|
||||
}
|
||||
}</span></span></bdi></span></ins></span></span></bdi></span></del></pre></div>
|
||||
<div id="loading" style="display: none;"></div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('articleForm');
|
||||
const result = document.getElementById('result');
|
||||
const loading = document.getElementById('loading');
|
||||
|
||||
const buttons = form.querySelectorAll('button');
|
||||
buttons.forEach(button => button.addEventListener('click', handleButtonClick));
|
||||
|
||||
function handleButtonClick(event) {
|
||||
let action = event.target.dataset.action;
|
||||
let id = '0';
|
||||
try {
|
||||
id = form.querySelector('input[name="id"]').value;
|
||||
if (!action) {
|
||||
action = form.querySelector('input[name="action"]').value;
|
||||
}
|
||||
} catch (e) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
loading.style.display = 'block'; // Mostra la clessidra
|
||||
|
||||
let baseUrl = window.location.href;
|
||||
baseUrl = baseUrl.slice(0, baseUrl.lastIndexOf('/'));
|
||||
|
||||
fetch(`${baseUrl}/handle-article-action-pao/${id}/${action}`)
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
result.innerHTML = data;
|
||||
loading.style.display = 'none'; // Nasconde la clessidra una volta completato
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<deepl-input-controller><template shadowrootmode="open"><link rel="stylesheet" href="chrome-extension://cofdbpoegempjloogbagkncekinflcnj/build/content.css"><div dir="ltr" style="visibility: initial !important;"><div class="dl-input-translation-container svelte-95aucy"><div></div></div></div></template></deepl-input-controller></body></html>
|
||||
@@ -1,839 +0,0 @@
|
||||
require('./config/config');
|
||||
require('./config/config');
|
||||
|
||||
// console.log(" lodash");
|
||||
|
||||
console.log(process.versions);
|
||||
|
||||
const _ = require('lodash');
|
||||
// console.log(" cors");
|
||||
const cors = require('cors');
|
||||
|
||||
// console.log(" 2) fs");
|
||||
const fs = require('fs');
|
||||
|
||||
var https = require('https');
|
||||
|
||||
const NUOVO_METODO_TEST = true;
|
||||
|
||||
const server_constants = require('./tools/server_constants');
|
||||
|
||||
//const throttle = require('express-throttle-bandwidth');
|
||||
// app.use(throttle(1024 * 128)) // throttling bandwidth
|
||||
|
||||
const port = process.env.PORT;
|
||||
|
||||
// var cookieParser = require('cookie-parser')
|
||||
// var csrf = require('csurf')
|
||||
const express = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const path = require('path');
|
||||
|
||||
const cron = require('node-cron');
|
||||
console.log('Starting mongoose...');
|
||||
|
||||
const tls = require('tls');
|
||||
|
||||
require('./db/mongoose');
|
||||
|
||||
// console.log('Starting pem...');
|
||||
|
||||
// const pem = require('pem')
|
||||
|
||||
const { Settings } = require('./models/settings');
|
||||
|
||||
const Site = require('./models/site');
|
||||
|
||||
// test
|
||||
|
||||
const i18n = require('i18n');
|
||||
|
||||
let credentials = null;
|
||||
|
||||
// OBTAIN
|
||||
// https://www.psclistens.com/insight/blog/enabling-a-nodejs-ssl-webserver-using-let-s-encrypt-pem-certificates/
|
||||
|
||||
|
||||
if ((process.env.NODE_ENV === 'production')) {
|
||||
console.log('*** AMBIENTE DI PRODUZIONE (Aprile 2024) !!!!')
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
console.log('*** ### AMBIENTE DI TEST ')
|
||||
}
|
||||
|
||||
|
||||
console.log('DB: ' + process.env.DATABASE);
|
||||
// console.log("PORT: " + port);
|
||||
// console.log("MONGODB_URI: " + process.env.MONGODB_URI);
|
||||
|
||||
var app = express();
|
||||
|
||||
|
||||
let telegrambot = null;
|
||||
|
||||
const tools = require('./tools/general');
|
||||
|
||||
const shared_consts = require('./tools/shared_nodejs');
|
||||
|
||||
var mongoose = require('mongoose').set('debug', false);
|
||||
|
||||
mongoose.set('debug', false);
|
||||
|
||||
const { CfgServer } = require('./models/cfgserver');
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
const populate = require('./populate/populate');
|
||||
const { Circuit } = require('./models/circuit');
|
||||
|
||||
const printf = require('util').format;
|
||||
|
||||
myLoad().then(ris => {
|
||||
|
||||
const { User } = require('./models/user');
|
||||
|
||||
require('./models/todo');
|
||||
require('./models/project');
|
||||
require('./models/subscribers');
|
||||
require('./models/booking');
|
||||
require('./models/sendmsg');
|
||||
require('./models/sendnotif');
|
||||
require('./models/mailinglist');
|
||||
require('./models/newstosent');
|
||||
require('./models/mypage');
|
||||
require('./models/myelem');
|
||||
require('./models/bot');
|
||||
require('./models/calzoom');
|
||||
const mysql_func = require('./mysql/mysql_func');
|
||||
|
||||
const index_router = require('./router/index_router');
|
||||
const push_router = require('./router/push_router');
|
||||
const newsletter_router = require('./router/newsletter_router');
|
||||
const booking_router = require('./router/booking_router');
|
||||
const dashboard_router = require('./router/dashboard_router');
|
||||
const myevent_router = require('./router/myevent_router');
|
||||
const subscribe_router = require('./router/subscribe_router');
|
||||
const sendmsg_router = require('./router/sendmsg_router');
|
||||
const sendnotif_router = require('./router/sendnotif_router');
|
||||
const email_router = require('./router/email_router');
|
||||
const todos_router = require('./router/todos_router');
|
||||
const test_router = require('./router/test_router');
|
||||
const projects_router = require('./router/projects_router');
|
||||
const report_router = require('./router/report_router');
|
||||
const users_router = require('./router/users_router');
|
||||
const reactions_router = require('./router/reactions_router');
|
||||
const mygroups_router = require('./router/mygroups_router');
|
||||
const circuits_router = require('./router/circuits_router');
|
||||
const accounts_router = require('./router/accounts_router');
|
||||
const iscrittiConacreis_router = require('./router/iscrittiConacreis_router');
|
||||
const iscrittiArcadei_router = require('./router/iscrittiArcadei_router');
|
||||
const site_router = require('./router/site_router');
|
||||
const admin_router = require('./router/admin_router');
|
||||
const products_router = require('./router/products_router');
|
||||
const cart_router = require('./router/cart_router');
|
||||
const orders_router = require('./router/orders_router');
|
||||
const city_router = require('./router/city_router');
|
||||
const myskills_router = require('./router/myskills_router');
|
||||
const mygoods_router = require('./router/mygoods_router');
|
||||
const mygen_router = require('./router/mygen_router');
|
||||
const aitools_router = require('./router/aitools_router');
|
||||
|
||||
const { MyEvent } = require('./models/myevent');
|
||||
|
||||
app.use(bodyParser.json({ limit: '50mb' }));
|
||||
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
|
||||
|
||||
app.use(express.static('views'));
|
||||
|
||||
// app.use(express.static(path.join(__dirname, 'client')));
|
||||
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// app.set('view engine', 'pug');
|
||||
|
||||
// Set static folder
|
||||
// app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
i18n.configure({
|
||||
locales: ['it', 'enUs', 'es', 'fr', 'pt', 'si'],
|
||||
defaultLocale: 'it',
|
||||
// cookie: 'cook',
|
||||
directory: __dirname + '/locales',
|
||||
api: {
|
||||
'__': 'translate',
|
||||
'__n': 'translateN'
|
||||
},
|
||||
});
|
||||
|
||||
app.use(cors({
|
||||
exposedHeaders: ['x-auth', 'x-refrtok'],
|
||||
}));
|
||||
|
||||
app.use(bodyParser.json());
|
||||
|
||||
// app.use(express.cookieParser());
|
||||
app.use(i18n.init);
|
||||
|
||||
console.log('Use Routes \...');
|
||||
|
||||
|
||||
// Use Routes
|
||||
app.use('/', index_router);
|
||||
app.use('/subscribe', subscribe_router);
|
||||
app.use('/sendmsg', sendmsg_router);
|
||||
app.use('/sendnotif', sendnotif_router);
|
||||
app.use('/push', push_router);
|
||||
app.use('/news', newsletter_router);
|
||||
app.use('/booking', booking_router);
|
||||
app.use('/dashboard', dashboard_router);
|
||||
app.use('/event', myevent_router);
|
||||
app.use('/email', email_router);
|
||||
app.use('/todos', todos_router);
|
||||
app.use('/test', test_router);
|
||||
app.use('/projects', projects_router);
|
||||
app.use('/users', users_router);
|
||||
app.use('/reactions', reactions_router);
|
||||
app.use('/mygroup', mygroups_router);
|
||||
app.use('/circuit', circuits_router);
|
||||
app.use('/account', accounts_router);
|
||||
app.use('/iscritti_conacreis', iscrittiConacreis_router);
|
||||
app.use('/iscritti_arcadei', iscrittiArcadei_router);
|
||||
app.use('/report', report_router);
|
||||
app.use('/site', site_router);
|
||||
app.use('/admin', admin_router);
|
||||
app.use('/products', products_router);
|
||||
app.use('/cart', cart_router);
|
||||
app.use('/orders', orders_router);
|
||||
app.use('/city', city_router);
|
||||
app.use('/myskills', myskills_router);
|
||||
app.use('/mygoods', mygoods_router);
|
||||
app.use('/mygen', mygen_router);
|
||||
app.use('/aitools', aitools_router);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
// app.use(function (req, res, next) {
|
||||
// var err = new Error('Not Found');
|
||||
// err.status = 404;
|
||||
// next(err);
|
||||
// });
|
||||
|
||||
// app.set('views', path.join(__dirname, 'views'));
|
||||
// app.set('view engine', 'pug');
|
||||
|
||||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
console.log('Server Error: ', err.message);
|
||||
// console.trace();
|
||||
res.status(err.status || 500).send({ error: err.message });
|
||||
// res.render('error', {
|
||||
// message: err.message,
|
||||
// error: err
|
||||
// });
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// require('./telegram/telegrambot');
|
||||
|
||||
// *** DB CONNECTIONS ***
|
||||
// mysql_func.mySqlConn_Shen.connect((err) => {
|
||||
// if (!err)
|
||||
// console.log('DB connection to Shen Database succeded.');
|
||||
// else
|
||||
// console.log('DB connection to Shen Database FAILED \n Error: ' + JSON.stringify(err, undefined, 2));
|
||||
// });
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
console.log('*** PRODUCTION! ');
|
||||
}
|
||||
|
||||
if ((process.env.NODE_ENV === 'production') ||
|
||||
(process.env.NODE_ENV === 'test')) {
|
||||
|
||||
const keyStream = path.resolve(`./${process.env.PATH_CERT_KEY}`);
|
||||
const certificateStream = path.resolve(`./${process.env.PATH_SERVER_CRT}`);
|
||||
|
||||
let privateKey = fs.readFileSync(keyStream, "utf8");
|
||||
let certificate = fs.readFileSync(certificateStream, "utf8");
|
||||
|
||||
let credentials = null;
|
||||
|
||||
|
||||
// arrSecureContext = ['piuchebuono.app', 'gruppomacro.app'];
|
||||
arrSecureContext = ['freeplanet.app', 'riso.app', 'comunitanuovomondo.app'];
|
||||
|
||||
let secureContext = {};
|
||||
|
||||
for (let i = 0; i < arrSecureContext.length; i++) {
|
||||
try {
|
||||
secureContext = {
|
||||
...secureContext,
|
||||
[arrSecureContext[i]]: tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/' + arrSecureContext[i] + '/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
})
|
||||
}
|
||||
|
||||
credentials = {
|
||||
SNICallback: function (domain, cb) {
|
||||
if (secureContext) {
|
||||
if (cb) {
|
||||
cb(null, secureContext);
|
||||
} else {
|
||||
// compatibility for older versions of node
|
||||
return secureContext;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Error: ' + err);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
let secureContext = {
|
||||
'piuchebuono.app': tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/piuchebuono.app/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
}),
|
||||
'gruppomacro.app': tls.createSecureContext({
|
||||
key: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/privkey.pem'),
|
||||
cert: fs.readFileSync('/etc/letsencrypt/live/gruppomacro.app/fullchain.pem')
|
||||
// ca: fs.readFileSync('../path_to_certificate_authority_bundle.ca-bundle1', 'utf8'), // this ca property is optional
|
||||
}),
|
||||
}*/
|
||||
|
||||
console.log('secureContext', secureContext);
|
||||
|
||||
if (NUOVO_METODO_TEST) {
|
||||
credentials = {
|
||||
SNICallback: function (domain, cb) {
|
||||
if (secureContext[domain]) {
|
||||
if (cb) {
|
||||
cb(null, secureContext[domain]);
|
||||
} else {
|
||||
// compatibility for older versions of node
|
||||
return secureContext[domain];
|
||||
}
|
||||
} else {
|
||||
throw new Error('No keys/certificates for domain requested');
|
||||
}
|
||||
},
|
||||
// must list a default key and cert because required by tls.createServer()
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
}
|
||||
|
||||
/*} else {
|
||||
// NON USATO !
|
||||
credentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
ca: [
|
||||
fs.readFileSync(process.env.PATH_SSL_ROOT_PEM, 'utf8'),
|
||||
fs.readFileSync(process.env.PATH_SSL_CHAIN_PEM, 'utf8'),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/*} else {
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.HTTPS_LOCALHOST === "true") {
|
||||
privateKey = fs.readFileSync(process.env.PATH_CERT_KEY, 'utf8');
|
||||
certificate = fs.readFileSync(process.env.PATH_SERVER_CRT, 'utf8');
|
||||
credentials = {
|
||||
key: privateKey,
|
||||
cert: certificate,
|
||||
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384',
|
||||
honorCipherOrder: true,
|
||||
secureProtocol: 'TLSv1_2_method',
|
||||
};
|
||||
|
||||
} else {
|
||||
var http = require('http');
|
||||
}
|
||||
|
||||
if ((process.env.NODE_ENV === 'production') ||
|
||||
(process.env.NODE_ENV === 'test') || process.env.HTTPS_LOCALHOST === "true") {
|
||||
|
||||
const httpsServer = https.createServer(credentials, app);
|
||||
|
||||
console.log('httpsServer: port ', port);
|
||||
httpsServer.listen(port);
|
||||
} else {
|
||||
console.log('httpServer: port ', port);
|
||||
const httpServer = http.createServer(app);
|
||||
httpServer.listen(port);
|
||||
}
|
||||
|
||||
mystart();
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// app.use(throttle(1024 * 128)); // throttling bandwidth
|
||||
|
||||
// app.use((req, res, next) => {
|
||||
// res.header('Access-Control-Allow-Origin', '*')
|
||||
// res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
|
||||
// next()
|
||||
// });
|
||||
|
||||
async function myLoad() {
|
||||
|
||||
return tools.loadApps();
|
||||
}
|
||||
|
||||
async function mystart() {
|
||||
|
||||
// await estraiTutteLeImmagini();
|
||||
|
||||
await tools.getApps();
|
||||
|
||||
if (process.env.PROD !== 1) {
|
||||
|
||||
testmsgwebpush();
|
||||
|
||||
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
||||
|
||||
let miapass = '';
|
||||
|
||||
if (miapass !== '') {
|
||||
let crypt = tools.cryptdata(miapass);
|
||||
let decrypt = tools.decryptdata(crypt);
|
||||
|
||||
console.log('crypted:', crypt);
|
||||
console.log('decrypted:', decrypt);
|
||||
}
|
||||
|
||||
mycron();
|
||||
if (!process.env.DEBUG) {
|
||||
mycron();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
telegrambot = require('./telegram/telegrambot');
|
||||
|
||||
await inizia();
|
||||
|
||||
await resetProcessingJob();
|
||||
|
||||
populate.popolaTabelleNuove();
|
||||
|
||||
faitest();
|
||||
|
||||
// ----------------- MAILCHIMP -----
|
||||
const querystring = require('querystring');
|
||||
const mailchimpClientId = 'xxxxxxxxxxxxxxxx';
|
||||
|
||||
app.get('/mailchimp/auth/authorize', function (req, res) {
|
||||
res.redirect('https://login.mailchimp.com/oauth2/authorize?' +
|
||||
querystring.stringify({
|
||||
'response_type': 'code',
|
||||
'client_id': mailchimpClientId,
|
||||
'redirect_uri': 'http://127.0.0.1:3000/mailchimp/auth/callback',
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// -----------------
|
||||
|
||||
function populateDBadmin() {
|
||||
const cfgserv = [
|
||||
{
|
||||
_id: new ObjectID(),
|
||||
idapp: '9',
|
||||
chiave: 'vers',
|
||||
userId: 'ALL',
|
||||
valore: '0.1.2',
|
||||
}];
|
||||
|
||||
let cfg = new CfgServer(cfgserv[0]).save();
|
||||
}
|
||||
|
||||
async function mycron() {
|
||||
|
||||
try {
|
||||
const sendemail = require('./sendemail');
|
||||
|
||||
const arr = await tools.getApps();
|
||||
|
||||
for (const app of arr) {
|
||||
sendemail.checkifPendingNewsletter(app.idapp);
|
||||
sendemail.checkifSentNewsletter(app.idapp);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Err mycron', e);
|
||||
}
|
||||
}
|
||||
|
||||
async function mycron_30min() {
|
||||
for (const app of await tools.getApps()) {
|
||||
let enablecrontab = false;
|
||||
|
||||
enablecrontab = await Settings.getValDbSettings(app.idapp,
|
||||
tools.ENABLE_CRONTAB, false);
|
||||
|
||||
if (enablecrontab) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function mycron_everyday() {
|
||||
try {
|
||||
|
||||
const { User } = require('./models/user');
|
||||
|
||||
const arrapps = await tools.getApps();
|
||||
for (const app of arrapps) {
|
||||
|
||||
// Azzera le richieste di password:
|
||||
const usersblocked = await User.find({ idapp: app.idapp, retry_pwd: { $exists: true, $gte: 29 } }).lean();
|
||||
for (const user of usersblocked) {
|
||||
await User.findOneAndUpdate({ _id: user._id }, { $set: { retry_pwd: 20 } });
|
||||
let text = `⚠️⚠️⚠️ L\'utente ${user.username} (${user.name} ${user.surname}) viene sbloccato dal numero massimo di tentativi di richiesta password!\nTelerlo d\'occhio !\n@${user.profile.username_telegram}`;
|
||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(text, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Crea un file con all'interno il nome del dominio per ogni app:
|
||||
await tools.createFileWithDomainName();
|
||||
|
||||
} catch (e) {
|
||||
console.error('mycron_everyday: ', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function testmsgwebpush() {
|
||||
const { User } = require('./models/user');
|
||||
|
||||
// console.log('nomeapp 1: ' , tools.getNomeAppByIdApp(1));
|
||||
// console.log('nomeapp 2: ' , tools.getNomeAppByIdApp(2));
|
||||
|
||||
User.find({ username: 'paoloar77', idapp: '1' }).then(async (arrusers) => {
|
||||
if (arrusers !== null) {
|
||||
for (const user of arrusers) {
|
||||
await tools.sendNotificationToUser(user._id, 'Server',
|
||||
'Il Server è Ripartito', '/', '', 'server', []).then(ris => {
|
||||
if (ris) {
|
||||
|
||||
} else {
|
||||
// already sent the error on calling sendNotificationToUser
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Cron every X minutes
|
||||
cron.schedule('*/1 * * * *', () => {
|
||||
// console.log('Running Cron Job');
|
||||
// if (!process.env.DEBUG) {
|
||||
mycron();
|
||||
// }
|
||||
});
|
||||
|
||||
// Cron every X minutes
|
||||
cron.schedule('*/60 * * * *', async () => {
|
||||
if (!process.env.DEBUG) {
|
||||
mycron_30min();
|
||||
}
|
||||
});
|
||||
|
||||
// Cron every 21:00 (1 volta al giorno)
|
||||
cron.schedule('0 21 * * *', async () => {
|
||||
mycron_everyday();
|
||||
});
|
||||
|
||||
// mycron_30min();
|
||||
|
||||
// tools.writelogfile('test', 'prova.txt');
|
||||
|
||||
async function resetProcessingJob() {
|
||||
|
||||
const { Newstosent } = require('./models/newstosent');
|
||||
|
||||
arrrec = await Newstosent.find({});
|
||||
|
||||
for (const rec of arrrec) {
|
||||
rec.processing_job = false;
|
||||
await Newstosent.findOneAndUpdate({ _id: rec.id }, { $set: rec }, { new: false }).
|
||||
then((item) => {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//app.listen(port, () => {
|
||||
// console.log(`Server started at port ${port}`);
|
||||
//});
|
||||
|
||||
async function inizia() {
|
||||
|
||||
try {
|
||||
if (true) {
|
||||
const url = 'https://raw.githubusercontent.com/matteocontrini/comuni-json/master/comuni.json';
|
||||
const outputPath = './comuni_italia_geojson.json';
|
||||
downloadGeoJSON(url, outputPath);
|
||||
}
|
||||
|
||||
mycron_everyday();
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
await telegrambot.sendMsgTelegram(tools.FREEPLANET,
|
||||
telegrambot.ADMIN_USER_SERVER,
|
||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}!`);
|
||||
|
||||
await telegrambot.sendMsgTelegramByIdTelegram(tools.FREEPLANET,
|
||||
telegrambot.ADMIN_IDTELEGRAM_SERVER,
|
||||
`Ciao ${telegrambot.ADMIN_USER_NAME_SERVER}\n` +
|
||||
`🔅 Il Server ${process.env.DATABASE} è appena ripartito!`);
|
||||
|
||||
} else {
|
||||
|
||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(`Ciao Admin\n` + `🔅🔅🔅 Il Server col BOT di {appname} è appena ripartito!`, false);
|
||||
|
||||
}
|
||||
|
||||
await Site.createFirstUserAdmin();
|
||||
|
||||
/*const {Circuit} = require('./models/circuit');
|
||||
|
||||
await Circuit.setDeperimentoOff();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
// telegrambot.sendMsgTelegramToTheManagers('7', 'PROVAAA!');
|
||||
|
||||
// if (process.env.PROD !== 1) {
|
||||
// const reg = require('./reg/registration');
|
||||
// const link = reg.getlinkregByEmail('7', 'tomasihelen@dasdasgmail.comAAAA' , 'HelenTomasidasdasd');
|
||||
// const link2 = reg.getlinkregByEmail('7', 'tomasihelen@gmail.com' , 'HelenTomasi');
|
||||
// //const link2 = reg.getlinkregByEmail('7', 'elenaliubicich@gmail.com' , 'Elenaliu');
|
||||
//
|
||||
// console.log(link);
|
||||
// console.log(link2);
|
||||
// }
|
||||
|
||||
async function estraiImmagini(table) {
|
||||
const { User } = require('./models/user');
|
||||
|
||||
let idapp = '13';
|
||||
|
||||
let arrlist;
|
||||
|
||||
const globalTables = require('./tools/globalTables');
|
||||
|
||||
|
||||
const mytable = globalTables.getTableByTableName(table);
|
||||
if (!mytable)
|
||||
return;
|
||||
|
||||
console.log('INIZIO - estraiImmagini', table);
|
||||
|
||||
arrlist = await mytable.find({ idapp }).lean();
|
||||
|
||||
let file = '';
|
||||
let filetocheck = '';
|
||||
let dirmain = '';
|
||||
let filefrom = '';
|
||||
let filefrom2 = '';
|
||||
let dir = tools.getdirByIdApp(idapp) + dirmain + '/upload/';
|
||||
|
||||
try {
|
||||
if (!tools.sulServer()) {
|
||||
dirmain = '/public';
|
||||
}
|
||||
|
||||
for (const rec of arrlist) {
|
||||
const myuser = await User.findOne({ idapp, _id: rec.userId }).lean();
|
||||
if (myuser) {
|
||||
const myphotos = rec.photos;
|
||||
|
||||
if (myphotos.length > 0) {
|
||||
let folderprof = dir + 'profile/' + myuser.username;
|
||||
|
||||
try {
|
||||
// console.log('checkdir', folderprof);
|
||||
if (!fs.existsSync(folderprof)) {
|
||||
console.log('*** Creadir', folderprof);
|
||||
fs.mkdirSync(folderprof);
|
||||
}
|
||||
|
||||
folderprof = dir + 'profile/' + myuser.username + '/' + table;
|
||||
// console.log('checkdir', folderprof);
|
||||
if (!fs.existsSync(folderprof)) {
|
||||
console.log('creadir', folderprof);
|
||||
fs.mkdirSync(folderprof);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (const photo of myphotos) {
|
||||
|
||||
if (photo.imagefile) {
|
||||
file = dir + 'profile/' + myuser.username + '/' + table + '/' +
|
||||
photo.imagefile;
|
||||
filefrom = dir + 'profile/undefined/' + table + '/' + photo.imagefile;
|
||||
filefrom2 = dir + 'profile/' + myuser.username + '/' + photo.imagefile;
|
||||
|
||||
// console.log('file', file);
|
||||
// console.log('filefrom', filefrom);
|
||||
|
||||
if (!tools.isFileExists(file)) {
|
||||
// non esiste
|
||||
console.log('non esiste', file);
|
||||
console.log(' filefrom', filefrom);
|
||||
console.log(' filefrom2', filefrom2);
|
||||
}
|
||||
|
||||
if (!tools.isFileExists(file) && tools.isFileExists(filefrom)) {
|
||||
console.log('@@@@@@ copia file:', filefrom, 'a', file);
|
||||
tools.copy(filefrom, file);
|
||||
}
|
||||
if (!tools.isFileExists(file) && tools.isFileExists(filefrom2)) {
|
||||
console.log('@@@@@@ copia file 2:', filefrom2, 'a', file);
|
||||
tools.copy(filefrom2, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('FINE - estraiImmagini', table);
|
||||
} catch (e) {
|
||||
console.error('e', e);
|
||||
}
|
||||
}
|
||||
|
||||
async function estraiTutteLeImmagini() {
|
||||
|
||||
await estraiImmagini('myskills');
|
||||
await estraiImmagini('mygoods');
|
||||
await estraiImmagini('mybachecas');
|
||||
}
|
||||
|
||||
async function faitest() {
|
||||
// console.log('Fai Test:')
|
||||
|
||||
const testfind = false;
|
||||
|
||||
// const $vers = tools.getVersionint('1.92.45');
|
||||
|
||||
if (true) {
|
||||
// tools.execScript("ls -la");
|
||||
}
|
||||
|
||||
if (false) {
|
||||
prova = tools.removeAtChar('@prova');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
const prova = tools.getConfSiteOptionEnabledByIdApp('13', shared_consts.ConfSite.Notif_Reg_Push_Admin);
|
||||
console.log('prova', prova);
|
||||
}
|
||||
|
||||
if (testfind) {
|
||||
const { City } = require('./models/city');
|
||||
|
||||
let miacity = 'roma';
|
||||
const ris = await City.findByCity(miacity);
|
||||
|
||||
console.log('ris', ris);
|
||||
}
|
||||
|
||||
const { User } = require('./models/user');
|
||||
|
||||
if (false) {
|
||||
let myuser = await User.findOne({
|
||||
idapp: '1',
|
||||
username: 'paoloar77',
|
||||
});
|
||||
const langdest = 'it';
|
||||
|
||||
telegrambot.askConfirmationUser(myuser.idapp, shared_consts.CallFunz.REGISTRATION, myuser);
|
||||
|
||||
}
|
||||
|
||||
if (false) {
|
||||
|
||||
const user = await User.findOne({
|
||||
idapp: 12,
|
||||
username: 'paolotest1',
|
||||
});
|
||||
|
||||
await sendemail.sendEmail_Registration('it', 'paolo@arcodiluce.it', user,
|
||||
'12', '');
|
||||
|
||||
}
|
||||
|
||||
if (false) {
|
||||
|
||||
const { User } = require('./models/user');
|
||||
|
||||
const idapp = tools.FREEPLANET;
|
||||
const idreg = 0;
|
||||
|
||||
try {
|
||||
|
||||
const user = await User.findOne({
|
||||
idapp,
|
||||
username: 'paoloar773',
|
||||
});
|
||||
|
||||
user.aportador_solidario = 'paoloar77';
|
||||
|
||||
let mylocalsconf = {
|
||||
idapp,
|
||||
dataemail: null,
|
||||
locale: user.lang,
|
||||
nomeapp: tools.getNomeAppByIdApp(idapp),
|
||||
strlinksito: tools.getHostByIdApp(idapp),
|
||||
strlinkreg: '',
|
||||
username: user.username,
|
||||
name: user.name,
|
||||
surname: user.surname,
|
||||
forgetpwd: tools.getHostByIdApp(idapp) + '/requestresetpwd',
|
||||
emailto: '',
|
||||
user,
|
||||
};
|
||||
|
||||
await telegrambot.notifyToTelegram(telegrambot.phase.REGISTRATION,
|
||||
mylocalsconf);
|
||||
} catch (e) {
|
||||
console.log('error ' + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { app };
|
||||
|
||||
1
docs/test.htm
Normal file
@@ -0,0 +1 @@
|
||||
<div class="row align-start" style="gap:0px;flex-direction:column;flex:1;display:flex;justify-content:space-between;"><!-- Parte superiore --><div class="justify-start" style="flex-grow:0"><span style="font-size:calc(12 * var(--scalecatalog) * 1px)" class="book-author">{autore}</span><div style="font-size:calc(16 * var(--scalecatalog) * 1px);font-weight:bold;" class="book-title">{titolo}</div><span class="book-descr">{descrizione}</span></div><!-- Parte inferiore (book-details e barcode) --><div style="margin-top:auto;width:100%"><div class="justify-end book-details" style="flex-grow:0;font-size:calc(10 * var(--scalecatalog) * 1px);">Pagine: <b>{pagine}</b><br />Formato: <b>{misure}</b><br />Prezzo: <b>{prezzo} €</b><br /></div></div></div>
|
||||
44879
docs/test.js
@@ -4,7 +4,6 @@ module.exports = {
|
||||
name: "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,
|
||||
|
||||
21
ecosystem.config.pcb_prod.js
Executable file
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "PiuCheBuono (Prod)",
|
||||
script: "/var/www/nodejs_piuchebuono_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||
//autorestart: true,
|
||||
instances: 1,
|
||||
watch: false,
|
||||
env: {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
log_file: "logs/combined.test.outerr.log",
|
||||
error_file: "logs/errtest.log",
|
||||
out_file: "logs/outtest.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -1,11 +1,10 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "TEST PiuCheBuono_ServerSide",
|
||||
name: "PiuCheBuono (TEST)",
|
||||
script: "/var/www/nodejs_test.piuchebuono_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
//autorestart: true,
|
||||
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||
instances: 1,
|
||||
watch: false,
|
||||
env: {
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "PRODUZIONE PiuCheBuono_ServerSide",
|
||||
name: "PRODUZIONE - FREEPLANET",
|
||||
script: "/var/www/www.freeplanet_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
@@ -11,9 +11,9 @@ module.exports = {
|
||||
env: {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
log_file: "logs/combined.test.outerr.log",
|
||||
error_file: "logs/errtest.log",
|
||||
out_file: "logs/outtest.log",
|
||||
log_file: "logs/combined.outerr.log",
|
||||
error_file: "logs/error.log",
|
||||
out_file: "logs/out.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
21
ecosystem.config.riso_prod.js
Executable file
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "RISO (Prod)",
|
||||
script: "/var/www/nodejs_riso_server/src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||
//autorestart: true,
|
||||
instances: 1,
|
||||
watch: false,
|
||||
env: {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
log_file: "logs/combined.outerr.log",
|
||||
error_file: "logs/error.log",
|
||||
out_file: "logs/out.log",
|
||||
merge_logs: true,
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -1,12 +1,11 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: "TESTRISO2 FreePlanetServerSide",
|
||||
name: "RISO (TEST)",
|
||||
script: "./src/server/server.js",
|
||||
ignore_watch: ["node_modules", "logs"],
|
||||
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||
interpreter: "/root/.nvm/versions/node/v22.13.1/bin/node",
|
||||
watch: false,
|
||||
//autorestart: true,
|
||||
instances: 1,
|
||||
env_test: {
|
||||
"PORT": 3001,
|
||||
BIN
emails/.DS_Store
vendored
@@ -64,7 +64,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.price
|
||||
- var after_price = rec.order.after_price
|
||||
- var TotalPriceProduct = rec.order.TotalPriceProductstr
|
||||
@@ -118,7 +118,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -62,7 +62,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.product.price
|
||||
- var after_price = rec.order.product.after_price
|
||||
if (rec.order.gasordine)
|
||||
@@ -117,7 +117,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -45,7 +45,7 @@ html
|
||||
p Ciao #{mioname},
|
||||
p L'ordine n. #{ordernumber} è stato Consegnato correttamente 📦 !
|
||||
p Grazie per averci scelto 🙏🏻 e alla prossima !
|
||||
p
|
||||
p
|
||||
|
||||
if (orders.items[0].order.quantitypreordered > 0)
|
||||
- var miomakeorder = mystorehouse.email_html_GAS_order_consegnato
|
||||
@@ -61,7 +61,7 @@ html
|
||||
|
||||
each rec in orders.items
|
||||
- var descr = rec.order.product.productInfo.name
|
||||
- var img = rec.order.product.productInfo.img
|
||||
- var img = dirimg + rec.order.product.productInfo.imagefile
|
||||
- var price = rec.order.product.price
|
||||
- var after_price = rec.order.product.after_price
|
||||
if (rec.order.gasordine)
|
||||
@@ -116,7 +116,7 @@ html
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
p Note Aggiuntive: #{note}<br>
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
|
||||
@@ -18,232 +18,270 @@
|
||||
- var baseimg = baseurl + '/'
|
||||
doctype html
|
||||
html
|
||||
- if (dataemail.title)
|
||||
head
|
||||
title dataemail.subject
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1")
|
||||
title= dataemail.title || "Email"
|
||||
style.
|
||||
/* embedded CSS */
|
||||
body { margin:0; padding:0; background:#E9F2F9; font-family:Tahoma, Geneva, sans-serif; color:#5b656e; }
|
||||
a { color:#09c; text-decoration:none; }
|
||||
table, td { border-collapse:collapse; }
|
||||
h1,h2,h3,p { margin:0; padding:0; }
|
||||
|
||||
//- 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")
|
||||
.logoContainer { text-align:center; padding:20px 0; }
|
||||
.logoContainer img { max-width:200px; }
|
||||
|
||||
//- embdedded css allowed, but not sass
|
||||
style.
|
||||
.red {
|
||||
background-color: #E84C50;
|
||||
}
|
||||
.testomail { padding:10px; font-size:0.75rem; line-height:1.4; }
|
||||
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
.clpromo {
|
||||
background-color:orange;
|
||||
text-align:center;
|
||||
font-size:1rem;
|
||||
padding:10px;
|
||||
color:#fff;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.emailContainer {
|
||||
background:#fff;
|
||||
border-radius:10px;
|
||||
padding:20px;
|
||||
margin:20px auto;
|
||||
}
|
||||
|
||||
.sectionArticleImage img {
|
||||
max-width:150px;
|
||||
border:1px solid #ccc;
|
||||
display:block;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.teacher {
|
||||
font-style:italic;
|
||||
font-size:0.75rem;
|
||||
color:#555;
|
||||
}
|
||||
|
||||
.contrib {
|
||||
font-size:0.75rem;
|
||||
font-weight:bold;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.button a {
|
||||
display:inline-block;
|
||||
padding:10px 20px;
|
||||
background:#f75666;
|
||||
color:#fff !important;
|
||||
text-decoration:none;
|
||||
border-radius:10px;
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
.button2 a {
|
||||
display:block;
|
||||
padding:12px 20px;
|
||||
background:#0000ff;
|
||||
color:#fff !important;
|
||||
text-decoration:none;
|
||||
border-radius:10px;
|
||||
font-size:1.15rem;
|
||||
}
|
||||
|
||||
.center_img img {
|
||||
display:block;
|
||||
margin:0 auto;
|
||||
}
|
||||
|
||||
.discContainer {
|
||||
background:#fff;
|
||||
border-radius:10px;
|
||||
padding:20px;
|
||||
margin:20px auto;
|
||||
}
|
||||
|
||||
.LinkDisc a {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.pDisc:hover {
|
||||
background:#5c8ef4 !important;
|
||||
color:#fff !important;
|
||||
}
|
||||
|
||||
.pDisc {
|
||||
padding:5px 10px;
|
||||
border-radius:10px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.socialMedia {
|
||||
background:#8bafcb;
|
||||
text-align:center;
|
||||
padding:10px 0;
|
||||
}
|
||||
|
||||
.socialMedia img {
|
||||
width:29px;
|
||||
height:auto;
|
||||
border:0;
|
||||
}
|
||||
|
||||
.firma-container {
|
||||
background:#ffffff;
|
||||
padding:15px;
|
||||
text-align:center;
|
||||
border-top:1px solid #e0e0e0;
|
||||
font-size:0.85rem;
|
||||
color:#313a42;
|
||||
}
|
||||
|
||||
.disclaimer-container {
|
||||
background:#f9f9f9;
|
||||
padding:15px;
|
||||
text-align:center;
|
||||
font-size:0.75rem;
|
||||
color:#666;
|
||||
border-top:1px solid #eee;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
|
||||
.bottom-container {
|
||||
background:#e9f2f9;
|
||||
padding:15px;
|
||||
text-align:center;
|
||||
font-size:0.7rem;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
.whitespace {
|
||||
line-height:0;
|
||||
font-size:0;
|
||||
height:20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width:480px) {
|
||||
.button a, .button2 a {
|
||||
font-size:1rem !important;
|
||||
width:100%;
|
||||
}
|
||||
.sectionArticleImage,
|
||||
.column {
|
||||
width:100% !important;
|
||||
display:block !important;
|
||||
}
|
||||
}
|
||||
body(yahoofix)
|
||||
span(id='body_style', style='display:block')
|
||||
table(class="topHeader", cellpadding="0", cellspacing="0", width="100%")
|
||||
- if (dataemail.height_logo)
|
||||
tr
|
||||
td
|
||||
table(cellpadding="0", cellspacing="0", align="center", summary="")
|
||||
tr
|
||||
td.logoContainer
|
||||
a(href=baseurl, title='logo')
|
||||
img.logo(src=baseurl+"/images/logo.png", height=dataemail.height_logo)
|
||||
|
||||
span#body_style(style='display:block')
|
||||
// Header
|
||||
table(width="100%", cellpadding="0", cellspacing="0", align="center")
|
||||
tr
|
||||
td.testomail
|
||||
p!= dataemail.templ.testoheadermail_out
|
||||
td.logoContainer
|
||||
a(href=baseurl)
|
||||
img.logo(src=baseurl+"/public/images/logo.png", alt="Logo")
|
||||
|
||||
- if (dataemail.templ.options.includes('SHOW_PROMO'))
|
||||
if dataemail.templ.testoheadermail_out
|
||||
tr
|
||||
td.testomail
|
||||
p!= dataemail.templ.testoheadermail_out
|
||||
|
||||
if dataemail.templ.options.includes('SHOW_PROMO')
|
||||
tr
|
||||
td.clpromo
|
||||
p!= dataemail.textpromo
|
||||
|
||||
- if (dataemail.templ.content)
|
||||
table(cellpadding="0", cellspacing="0", width="95%", align="center")
|
||||
// Main Content
|
||||
if dataemail.templ.content
|
||||
tr
|
||||
td.emailContainer
|
||||
p!=dataemail.templ.content
|
||||
if dataemail.templ.img
|
||||
img(src=baseimg + dataemail.templ.img, class="center_img")
|
||||
if dataemail.templ.content2
|
||||
p!=dataemail.templ.content2
|
||||
if dataemail.templ.img2
|
||||
img(src=baseimg + dataemail.templ.img2, class="center_img")
|
||||
|
||||
// Events
|
||||
if dataemail.templ.options.includes('SHOW_EVENTS')
|
||||
each event in arrevents
|
||||
tr
|
||||
td(class="textIniContainer", valign="top")
|
||||
p!=dataemail.templ.content
|
||||
- if (dataemail.templ.img)
|
||||
img(src=baseimg + dataemail.templ.img, alt="", class="myimg")
|
||||
- if (dataemail.templ.content2)
|
||||
p!=dataemail.templ.content2
|
||||
- if (dataemail.templ.img2)
|
||||
img(src=baseimg + dataemail.templ.img2, alt="", class="myimg")
|
||||
|
||||
table(cellpadding="0", cellspacing="0", width="640", align="center")
|
||||
- if (dataemail.templ.options.includes('SHOW_EVENTS'))
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
p
|
||||
tr
|
||||
td(class="emailContainer", valign="top")
|
||||
|
||||
each event in arrevents
|
||||
- var urlevent = baseurl + '/event/' + event.typol + '?eventid=' + event._id
|
||||
- var imgev = event.img_small
|
||||
- var mydate = prettyDate(event.dateTimeStart)
|
||||
unless (imgev)
|
||||
- imgev = event.img
|
||||
- var teacher1 = ''
|
||||
- var teacher2 = ''
|
||||
- var teacher3 = ''
|
||||
- var teacher4 = ''
|
||||
- var contrib = ''
|
||||
- var myclteach = 'q-chip'
|
||||
- if (event.op1[0] && event.op1[0].username !== 'nessuno')
|
||||
- teacher1 = event.op1[0].name + ' ' + event.op1[0].surname
|
||||
- if ((event.op2[0] && event.op2[0].username !== 'nessuno'))
|
||||
- teacher2 = event.op2[0].name + ' ' + event.op2[0].surname
|
||||
- myclteach = 'q-chip2'
|
||||
- if (event.op3[0] && event.op3[0].username !== 'nessuno')
|
||||
- teacher3 = "<br>" . event.op3[0].name + ' ' + event.op3[0].surname
|
||||
- if (event.op4[0] && event.op4[0].username !== 'nessuno')
|
||||
- teacher4 = "<br>" . event.op4[0].name + ' ' + event.op4[0].surname
|
||||
|
||||
- if (event.contrib[0])
|
||||
- contrib = event.contrib[0].label
|
||||
- if (event.contrib[0].showprice)
|
||||
- contrib += ' ' + event.price + ' €'
|
||||
|
||||
|
||||
table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
td.emailContainer
|
||||
table(width="100%", cellpadding="0", cellspacing="0")
|
||||
tr
|
||||
td(class="column sectionArticleImage", valign="top")
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
- if (event.news)
|
||||
tr
|
||||
td
|
||||
p(class="q-chip row inline no-wrap items-center cltexth5 chipnews shadow-5 glossy text-right bg-red text-white") Novità
|
||||
td.column.sectionArticleImage(width="150")
|
||||
if event.news
|
||||
p.q-chip.bg-red.text-white Novità
|
||||
img(src=baseimg + (event.img_small || event.img), alt=event.title)
|
||||
p.teacher= event.op1[0].name + ' ' + event.op1[0].surname
|
||||
td.column
|
||||
h2.sectionContentTitle= event.title
|
||||
p.sectionContentSubTitle= prettyDate(event.dateTimeStart)
|
||||
p.sectionContent!= event.details
|
||||
if event.contrib.length
|
||||
p.contrib= event.contrib[0].label + (event.contrib[0].showprice ? ' ' + event.price + ' €' : '')
|
||||
table.buttonContainer
|
||||
tr
|
||||
td
|
||||
img(src=baseimg + imgev, alt="", width="150")
|
||||
p(class="teacher") #{teacher1} <br> #{teacher2} #{teacher3} #{teacher4}
|
||||
td(class="column", valign="top")
|
||||
td.button
|
||||
a(href=baseurl + '/event/' + event.typol + '?eventid=' + event._id, target="_blank") Apri l'Evento
|
||||
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
tr
|
||||
td(class="sectionContentTitle boldhigh", valign="top")
|
||||
p #{event.title}
|
||||
tr
|
||||
td(class="sectionContentSubTitle", valign="top")
|
||||
p(class="q-chip row inline no-wrap items-center cltexth5 chipnews shadow-5 glossy text-right bg-blue text-white") #{mydate}
|
||||
tr
|
||||
td(class="sectionContent", valign="top")
|
||||
p!= event.details
|
||||
p.contrib= contrib
|
||||
tr
|
||||
td(class="buttonContainer")
|
||||
table(width="50%", cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
tr
|
||||
td(class="button hoverLink")
|
||||
a(href=urlevent, title='Evento', target='_blank') Apri l'Evento
|
||||
tr
|
||||
td.center_img
|
||||
a.button2(href=urlcal, target="_blank") Calendario Eventi
|
||||
|
||||
// Disciplines
|
||||
if dataemail.templ.options.includes('SHOW_DISC')
|
||||
tr
|
||||
td.center
|
||||
h2.cltitle_disc= dataemail.disc_title
|
||||
each disc in dataemail.arrdiscipline
|
||||
tr
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0", align="center", class="")
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
p
|
||||
tr
|
||||
td.center_img(class="button2 hoverLink")
|
||||
a(href=urlcal, title='Calendario Eventi', target='_blank') Calendario Eventi
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
p
|
||||
|
||||
- if (dataemail.templ.options.includes('SHOW_DISC'))
|
||||
tr
|
||||
td(class="whitespace bg-white", height="20")
|
||||
p(class="bg-white")
|
||||
tr
|
||||
td(class="center")
|
||||
p(class="cltitle_disc") #{dataemail.disc_title}
|
||||
tr
|
||||
td(class="discContainer", valign="top")
|
||||
|
||||
each disc in dataemail.arrdiscipline
|
||||
- var urldisc = baseurl + disc.linkpage
|
||||
- var imgdisc = disc.img_small
|
||||
unless (imgdisc)
|
||||
- imgdisc = disc.img
|
||||
|
||||
table(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
td.discContainer
|
||||
table(width="100%", cellpadding="0", cellspacing="0")
|
||||
tr
|
||||
td(class="column sectionArticleImage", valign="top")
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
tr
|
||||
td
|
||||
img(src=baseimg + imgdisc, alt="", width="150")
|
||||
td(class="column", valign="top")
|
||||
td.column.sectionArticleImage(width="150")
|
||||
img(src=baseimg + (disc.img_small || disc.img), alt=disc.label)
|
||||
td.column
|
||||
p.LinkDisc
|
||||
a(href=baseurl + disc.linkpage, target="_blank")
|
||||
span.pDisc(style=`background-color:`+disc.color)= disc.label
|
||||
p.sectionContent!= disc.description
|
||||
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
tr
|
||||
td(class="sectionContentTitle boldhigh center LinkDisc", valign="top")
|
||||
a(href=urldisc, title='Disciplina', target='_blank')
|
||||
p(class="q-chip row inline no-wrap items-center cltexth4 chipnews shadow-5 glossy text-right text-white pDisc", style=`background-color: `+disc.color) #{disc.label}
|
||||
tr
|
||||
td(class="sectionContent", valign="top")
|
||||
p!= disc.description
|
||||
|
||||
tr
|
||||
td(class="whitespace", height="20")
|
||||
p
|
||||
|
||||
- if (dataemail.content_after_events)
|
||||
// Additional Content
|
||||
if dataemail.content_after_events
|
||||
tr
|
||||
table(cellpadding="0", cellspacing="0", summary="", border="0")
|
||||
tr
|
||||
td.testomail
|
||||
p!=dataemail.content_after_events
|
||||
tr
|
||||
td(class="whitespace", height="20")
|
||||
p
|
||||
td.testomail
|
||||
p!=dataemail.content_after_events
|
||||
|
||||
// Social Media
|
||||
table.socialMedia(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
tr
|
||||
td(class="whitespace", height="5")
|
||||
p
|
||||
tr
|
||||
td
|
||||
table(width="120", cellpadding="0", cellspacing="0", summary="", border="0", align="center")
|
||||
tr
|
||||
- if (dataemail.urlinstagram)
|
||||
td(width="32", align="center")
|
||||
a(href=dataemail.urlinstagram, title='Instagram')
|
||||
img(src=imginstagram, alt="Instagram", width="29")
|
||||
- if (dataemail.urltwitter)
|
||||
td(width="32", align="center")
|
||||
a(href=dataemail.urltwitter, title='Twitter')
|
||||
img(src=imgtwitter, alt="Twitter", width="29")
|
||||
- if (dataemail.urlfb)
|
||||
td(width="32", align="center")
|
||||
a(href=dataemail.urlfb, title='Facebook')
|
||||
img(src=imgfb, alt="Facebook", width="29")
|
||||
- if (dataemail.urlyoutube)
|
||||
td(width="32", align="center")
|
||||
a(href=dataemail.urlyoutube, title='YouTube')
|
||||
img(src=imgyoutube, alt="YouTube", width="29")
|
||||
|
||||
tr
|
||||
td(class="whitespace", height="5")
|
||||
p
|
||||
tr
|
||||
td.socialMedia
|
||||
table(width="120", align="center", cellpadding="0", cellspacing="0")
|
||||
if dataemail.urlinstagram
|
||||
td
|
||||
a(href=dataemail.urlinstagram)
|
||||
img(src=imginstagram, alt="Instagram")
|
||||
if dataemail.urltwitter
|
||||
td
|
||||
a(href=dataemail.urltwitter)
|
||||
img(src=imgtwitter, alt="Twitter")
|
||||
if dataemail.urlfb
|
||||
td
|
||||
a(href=dataemail.urlfb)
|
||||
img(src=imgfb, alt="Facebook")
|
||||
if dataemail.urlyoutube
|
||||
td
|
||||
a(href=dataemail.urlyoutube)
|
||||
img(src=imgyoutube, alt="YouTube")
|
||||
|
||||
// Footer
|
||||
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
p
|
||||
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
|
||||
tr
|
||||
td.firma-container
|
||||
p!= dataemail.firma
|
||||
tr
|
||||
td.disclaimer-container
|
||||
p!= dataemail.disclaimer_out
|
||||
tr
|
||||
td.bottom-container
|
||||
p!= dataemail.disc_bottom_out
|
||||
@@ -1,10 +1,21 @@
|
||||
p Ciao #{name},
|
||||
p Hai ricevuto
|
||||
strong #{qty} #{symbol}
|
||||
| da parte di #{mittente} sul
|
||||
strong #{nomecircuito} !
|
||||
p Hai ricevuto
|
||||
strong #{qty} #{symbol}
|
||||
if groupDestoContoCom
|
||||
| sul conto
|
||||
strong #{groupDestoContoCom}
|
||||
span da parte di #{mittente} in data #{transactionDate} sul
|
||||
strong #{nomecircuito} !
|
||||
if causalDest
|
||||
p <br>
|
||||
p Descrizione: #{causalDest}
|
||||
if causale
|
||||
p <br>
|
||||
p Commento di #{mittente}: #{causale}
|
||||
p <br>
|
||||
p Apri #{nomeapp} per vedere il tuo nuovo saldo.
|
||||
p Apri
|
||||
strong <a href=#{strlinksito} target="_blank">#{nomeapp}</a>
|
||||
span per vedere il tuo nuovo saldo.
|
||||
p <br>
|
||||
p Cordiali Saluti
|
||||
p Supporto #{nomeapp}
|
||||
|
||||
170
filelog.txt
@@ -1,170 +1,6 @@
|
||||
|
||||
Ven 02/12 ORE 11:16: USER [surya1977]: 💫🍚 progetto riso: 🍚💫
|
||||
rete italiana di scambio orizzontale
|
||||
siamo una rete di comunità consapevoli, basata sul sostegno reciproco, la fiducia, la condivisione e l'ascolto.
|
||||
coltiviamo terreno fertile per creare, in armonia con la natura, un mondo di collettività libere e autosufficienti, attraverso un circuito di scambio di esperienze umane, beni e servizi.
|
||||
Dom 02/03 ORE 16:32: USER [surya1977]: ciao
|
||||
|
||||
1️⃣ 👉🏻 entra nel canale progetto riso:
|
||||
sul post fissato in alto, troverai tutte le info sul progetto e su come entrare nel gruppo della tua provincia.
|
||||
Lun 10/03 ORE 15:52: USER [surya1977]: ciao
|
||||
|
||||
2️⃣ 👉🏻 registrati alla app di riso (anche da pc), dove potrai:
|
||||
|
||||
✅ inserire i tuoi talenti e ciò che sai fare, offrendo beni, servizi, ospitalità, eventi.
|
||||
✅ entrare nel circuito della tua città per condividere e scambiare di persona.
|
||||
✅ utilizzare il ris come strumento di scambio (moneta virtuale) tra i membri della comunità territoriale della tua provincia.
|
||||
|
||||
👉🏻 🔥 clicca qui per registrarti su riso app
|
||||
|
||||
entrando sul bot riso premi su avvia (o start) e segui le istruzioni
|
||||
|
||||
3️⃣ condividi il progetto ai tuoi amici ed aiuta così a far crescere questa rete e crescere insieme 💚 partecipa al cambiamento. riso sei anche tu.
|
||||
se hai bisogno di aiuto chiedi in questa chat: 👉🏻 chat riso help
|
||||
|
||||
Gio 05/01 ORE 19:28: USER [paoloar77]: vai al sito
|
||||
|
||||
Gio 05/01 ORE 19:28: USER [paoloar77]: link da condividere
|
||||
|
||||
Gio 16/02 ORE 18:14: USER [paoloar77]: vai al sito
|
||||
|
||||
Mar 06/06 ORE 19:39: USER [paoloar77]: ciaooooooooooooooooo
|
||||
|
||||
Mar 06/06 ORE 19:54: USER [paoloar77]: dasjdalksjdasdklasjkldasjlkdjasl
|
||||
|
||||
Sab 17/06 ORE 20:03: USER [paoloar77]: pro v adsasdasdaksdas
|
||||
|
||||
Dom 18/06 ORE 19:22: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:42: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:58: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:59: USER [paoloar77]: /start inv
|
||||
|
||||
Dom 18/06 ORE 19:59: USER [paoloar77]: /start inv
|
||||
|
||||
Ven 23/06 ORE 14:08: USER [paoloar77]: link da condividere
|
||||
|
||||
Sab 30/09 ORE 00:21: USER [SuryaArena]: vai al sito
|
||||
|
||||
Sab 30/09 ORE 00:32: USER [SuryaArena]: vai al sito
|
||||
|
||||
Gio 12/10 ORE 11:11: USER [paoloar77]: prova
|
||||
|
||||
Gio 12/10 ORE 11:48: USER [paoloar77]: prova
|
||||
|
||||
Gio 12/10 ORE 12:07: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:07: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:09: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:10: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:10: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:13: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:14: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:16: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:21: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:33: USER [paoloar77]: prova
|
||||
|
||||
Gio 12/10 ORE 12:33: USER [SuryaArena]: ciao
|
||||
|
||||
Gio 12/10 ORE 12:33: USER [SuryaArena]: prova
|
||||
|
||||
Gio 12/10 ORE 12:45: USER [SuryaArena]: bottone
|
||||
|
||||
Gio 12/10 ORE 14:49: USER [paoloar77]: bottone
|
||||
|
||||
Gio 12/10 ORE 14:49: USER [paoloar77]: bottone
|
||||
|
||||
Gio 12/10 ORE 14:49: USER [paoloar77]: bottone
|
||||
|
||||
Gio 12/10 ORE 14:52: USER [paoloar77]: bottone
|
||||
|
||||
Gio 12/10 ORE 14:57: USER [paoloar77]: bottone
|
||||
|
||||
Gio 12/10 ORE 15:06: USER [paoloar77]: bottone
|
||||
|
||||
Ven 13/10 ORE 11:05: 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; l’utente 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 03/07 ORE 13:13: USER [paoloar77]: ciao
|
||||
Lun 10/03 ORE 15:56: USER [surya1977]: ciao
|
||||
|
||||
1
localhost-key.pem
Symbolic link
@@ -0,0 +1 @@
|
||||
/Users/suryapaolo/certs/localhost-key.pem
|
||||
1
localhost.pem
Symbolic link
@@ -0,0 +1 @@
|
||||
/Users/suryapaolo/certs/localhost.pem
|
||||
181
logtrans.txt
@@ -304,4 +304,183 @@ BlediMakeru: 25.00 RIS]
|
||||
Dom 29/09 ORE 23:24: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (Anna50823) a franz12090 15 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (Anna50823): -397.00 RIS]
|
||||
franz12090: 20.00 RIS]
|
||||
franz12090: 20.00 RIS]
|
||||
Lun 30/09 ORE 22:42: [<b>Circuito RIS Italia</b>]: Inviate Monete da laura.nocera a Emilie 4 RIS [causale: carissima siccome ieri non ho potuto darli subito te li invio ora, inoltre un piccolo regalo per i tuoi bei figli per cui ti mando 4 ris invece che 2, un abbraccio e civediamo alla prossima ]
|
||||
Saldi:
|
||||
laura.nocera: -4.00 RIS]
|
||||
Emilie: 4.00 RIS]
|
||||
Lun 30/09 ORE 22:48: [<b>Circuito RIS Foggia</b>]: Inviate Monete da sergiomazzanti a pomps61 5 RIS [causale: ]
|
||||
Saldi:
|
||||
sergiomazzanti: 20.00 RIS]
|
||||
pomps61: 0.00 RIS]
|
||||
Lun 30/09 ORE 22:52: [<b>Circuito RIS Bologna</b>]: Inviate Monete da pontiUmani (Anna50823) a Naanbe 15 RIS [causale: ]
|
||||
Saldi:
|
||||
pontiUmani (Anna50823): -412.00 RIS]
|
||||
Naanbe: 3.00 RIS]
|
||||
Lun 30/09 ORE 22:54: [<b>Circuito RIS Bologna</b>]: Inviate Monete da ZeoPleiadi a pepedielena 1.5 RIS [causale: ]
|
||||
Saldi:
|
||||
ZeoPleiadi: 8.00 RIS]
|
||||
pepedielena: 1.50 RIS]
|
||||
Lun 30/09 ORE 22:55: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: Mio Commento !!! Ciaoooooooo.
|
||||
Ecome stai ????]
|
||||
Saldi:
|
||||
paoloar77: 21.00 RIS]
|
||||
ElenaEspx: 29.40 RIS]
|
||||
Lun 30/09 ORE 22:58: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 0.01 RIS [causale: Prova del commento. Ciaooo come stai . Tutto benekfaòjd ask dakisj dlaks jdlkas jdlakdklasj dlkas jdlasd]
|
||||
Saldi:
|
||||
paoloar77: 20.99 RIS]
|
||||
ElenaEspx: 29.41 RIS]
|
||||
Mer 02/10 ORE 00:26: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a PiuCheBuono(GaseBottega) 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 101.50 RIS]
|
||||
PiuCheBuono(GaseBottega): -64.50 RIS]
|
||||
Mer 02/10 ORE 00:51: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 100.50 RIS]
|
||||
TestTransazPao: 1.00 RIS]
|
||||
Mer 02/10 ORE 02:07: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: dsadasdada]
|
||||
Saldi:
|
||||
paoloar77: 95.50 RIS]
|
||||
TestTransazPao: 6.00 RIS]
|
||||
Mer 02/10 ORE 02:10: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: DSDA Ciaoooooooo]
|
||||
Saldi:
|
||||
paoloar77: 88.50 RIS]
|
||||
TestTransazPao: 13.00 RIS]
|
||||
Mer 02/10 ORE 02:16: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 0.5 RIS [causale: Miaooooooooo]
|
||||
Saldi:
|
||||
paoloar77: 88.00 RIS]
|
||||
TestTransazPao: 13.50 RIS]
|
||||
Mer 02/10 ORE 02:19: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: AAAAA]
|
||||
Saldi:
|
||||
paoloar77: 86.00 RIS]
|
||||
TestTransazPao: 15.50 RIS]
|
||||
Mer 02/10 ORE 02:21: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 85.00 RIS]
|
||||
TestTransazPao: 16.50 RIS]
|
||||
Mer 02/10 ORE 02:24: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 83.00 RIS]
|
||||
TestTransazPao: 18.50 RIS]
|
||||
Mer 02/10 ORE 02:25: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 19.99 RIS]
|
||||
ElenaEspx: 30.41 RIS]
|
||||
Mer 02/10 ORE 03:31: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 3 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 16.99 RIS]
|
||||
ElenaEspx: 33.41 RIS]
|
||||
Gio 03/10 ORE 15:13: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: ]
|
||||
Saldi:
|
||||
paoloar77: 14.99 RIS]
|
||||
TestTransazPao: 2.00 RIS]
|
||||
Ven 04/10 ORE 01:33: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Grazie Mille :D Un abbraccione tanto forte]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 12.99 RIS]
|
||||
ElenaEspx: 35.41 RIS]
|
||||
Ven 04/10 ORE 01:35: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Grazie di tutto]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 10.99 RIS]
|
||||
ElenaEspx: 37.41 RIS]
|
||||
Ven 04/10 ORE 01:36: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Ecco il mio commento]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 8.99 RIS]
|
||||
ElenaEspx: 39.41 RIS]
|
||||
Ven 04/10 ORE 01:50: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 2 RIS [causale: Altra prova aaaa]
|
||||
Causale Destinatario: ProvaCommento
|
||||
Saldi:
|
||||
paoloar77: 6.99 RIS]
|
||||
ElenaEspx: 41.41 RIS]
|
||||
Dom 27/10 ORE 23:50: [<b>Circuito RIS Foggia</b>]: Inviate Monete da sergiomazzanti a SamuelMast 10 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
sergiomazzanti: 10.00 RIS]
|
||||
SamuelMast: -76.00 RIS]
|
||||
Dom 27/10 ORE 23:55: [<b>Circuito RIS Campania</b>]: Inviate Monete da Unicorno_Giacomo a zacc50 16 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
Unicorno_Giacomo: 227.30 RIS]
|
||||
zacc50: -62.00 RIS]
|
||||
Dom 03/11 ORE 19:28: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: prova]
|
||||
|
||||
Saldi:
|
||||
paoloar77: 82.00 RIS]
|
||||
ElenaEspx: -49.10 RIS]
|
||||
Dom 03/11 ORE 19:32: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: provaaaa]
|
||||
|
||||
Saldi:
|
||||
paoloar77: 81.00 RIS]
|
||||
ElenaEspx: -48.10 RIS]
|
||||
Gio 09/01 ORE 17:04: [<b>Circuito RIS TerraNFT</b>]: Inviate Monete da terranft (paoloar77) a SuryaArena 30 RIS [causale: Iniziale]
|
||||
|
||||
Saldi:
|
||||
terranft (paoloar77): -30.00 RIS]
|
||||
SuryaArena: 30.00 RIS]
|
||||
Ven 28/02 ORE 19:40: [<b>Circuito RIS Bologna</b>]: Inviate Monete da surya1977 a SuryaSecondo 2 RIS [causale: aaa]
|
||||
|
||||
Saldi:
|
||||
surya1977: 33.90 RIS]
|
||||
SuryaSecondo: 2.10 RIS]
|
||||
Lun 03/03 ORE 00:38: [<b>Circuito RIS Bologna</b>]: Inviate Monete da surya1977 a SuryaSecondo 3 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
surya1977: 30.90 RIS]
|
||||
SuryaSecondo: 5.10 RIS]
|
||||
Lun 03/03 ORE 00:40: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a Giovannifruttadisicilia 5.4 RIS [causale: aranceee !!]
|
||||
|
||||
Saldi:
|
||||
surya1977: 62.55 RIS]
|
||||
Giovannifruttadisicilia: 362.40 RIS]
|
||||
Lun 03/03 ORE 01:06: [<b>Circuito RIS Arezzo</b>]: Inviate Monete da surya1977 a Andro 1 RIS [causale: test]
|
||||
|
||||
Saldi:
|
||||
surya1977: -1.10 RIS]
|
||||
Andro: 1.00 RIS]
|
||||
Mer 12/03 ORE 21:30: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a Giovannifruttadisicilia 60 RIS [causale: prova]
|
||||
|
||||
Saldi:
|
||||
surya1977: 34.20 RIS]
|
||||
Giovannifruttadisicilia: 458.50 RIS]
|
||||
Gio 13/03 ORE 17:44: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a PiuCheBuono(GaseBottega) 1 RIS [causale: AAA]
|
||||
|
||||
Saldi:
|
||||
surya1977: 33.20 RIS]
|
||||
PiuCheBuono(GaseBottega): -65.50 RIS]
|
||||
Gio 13/03 ORE 17:45: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a PiuCheBuono(GaseBottega) 3.2 RIS [causale: GGG]
|
||||
|
||||
Saldi:
|
||||
surya1977: 30.00 RIS]
|
||||
PiuCheBuono(GaseBottega): -62.30 RIS]
|
||||
Gio 13/03 ORE 18:17: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a pontiUmani 2 RIS [causale: bbb]
|
||||
|
||||
Saldi:
|
||||
surya1977: 28.00 RIS]
|
||||
pontiUmani: 2.00 RIS]
|
||||
Gio 13/03 ORE 18:18: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 2 RIS [causale: ggg]
|
||||
|
||||
Saldi:
|
||||
surya1977: 26.00 RIS]
|
||||
GruppoYurta: 2.00 RIS]
|
||||
Gio 13/03 ORE 18:48: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 11 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
surya1977: 15.00 RIS]
|
||||
GruppoYurta: 13.00 RIS]
|
||||
Gio 13/03 ORE 18:53: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 3 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
surya1977: 12.00 RIS]
|
||||
GruppoYurta: 16.00 RIS]
|
||||
Gio 13/03 ORE 18:57: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 1 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
surya1977: 11.00 RIS]
|
||||
GruppoYurta: 17.00 RIS]
|
||||
Dom 23/03 ORE 22:24: [<b>Circuito RIS Italia</b>]: Inviate Monete da surya1977 a GruppoYurta 1 RIS [causale: ]
|
||||
|
||||
Saldi:
|
||||
surya1977: 88.20 RIS]
|
||||
GruppoYurta: 6.00 RIS]
|
||||
98
package.json
@@ -13,71 +13,75 @@
|
||||
"starttest": "NODE_ENV=test node src/server/server.js",
|
||||
"test-watch": "nodemon --exec 'npm test'"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.19.0"
|
||||
},
|
||||
"author": "Paolo Arena",
|
||||
"author": "Surya",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"basic-ftp": "^5.0.2",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"basic-ftp": "^5.0.5",
|
||||
"bcryptjs": "^3.0.2",
|
||||
"bluebird": "^3.7.2",
|
||||
"body-parser": "^1.20.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"body-parser": "^1.20.3",
|
||||
"cookie-parser": "^1.4.7",
|
||||
"cors": "^2.8.5",
|
||||
"country-codes-list": "^1.6.8",
|
||||
"crypto-js": "^4.1.1",
|
||||
"country-codes-list": "^2.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
"csurf": "^1.11.0",
|
||||
"dotenv": "^16.0.2",
|
||||
"ejs": "^3.1.8",
|
||||
"email-templates": "^10.0.1",
|
||||
"express": "^4.18.1",
|
||||
"formidable": "^2.0.1",
|
||||
"i18n": "^0.15.0",
|
||||
"dotenv": "^16.4.7",
|
||||
"ejs": "^3.1.10",
|
||||
"email-templates": "^12.0.2",
|
||||
"express": "^4.21.2",
|
||||
"formidable": "^3.5.2",
|
||||
"ghostscript4js": "^3.2.3",
|
||||
"i18n": "^0.15.1",
|
||||
"image-downloader": "^4.3.0",
|
||||
"internet-available": "^1.0.0",
|
||||
"jade": "^1.9.2",
|
||||
"jsdom": "^24.0.0",
|
||||
"jsonwebtoken": "^9.0.1",
|
||||
"jade": "^1.11.0",
|
||||
"jsdom": "^26.0.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lodash": "^4.17.21",
|
||||
"mongodb": "^4.4.1",
|
||||
"mongoose": "^5.13.15",
|
||||
"mongodb": "^6.14.2",
|
||||
"mongoose": "^8.12.1",
|
||||
"multer": "^1.4.5-lts.2",
|
||||
"mysql": "^2.18.1",
|
||||
"node-cron": "^3.0.2",
|
||||
"node-emoji": "^1.11.0",
|
||||
"node-cron": "^3.0.3",
|
||||
"node-emoji": "^2.2.0",
|
||||
"node-image-resizer": "^1.0.0",
|
||||
"node-pre-gyp": "^0.14.0",
|
||||
"node-pre-gyp": "^0.17.0",
|
||||
"node-pty": "^1.0.0",
|
||||
"node-telegram-bot-api": "^0.65.1",
|
||||
"nodemailer": "^6.7.8",
|
||||
"npm-check-updates": "^16.14.18",
|
||||
"pem": "^1.14.6",
|
||||
"preview-email": "^3.0.7",
|
||||
"pug": "^3.0.2",
|
||||
"rate-limiter-flexible": "^2.3.9",
|
||||
"request": "^2.34",
|
||||
"sanitize-html": "^2.13.0",
|
||||
"save": "^2.5.0",
|
||||
"sharp": "^0.30.7",
|
||||
"superagent": "^8.0.0",
|
||||
"node-telegram-bot-api": "^0.66.0",
|
||||
"nodemailer": "^6.10.0",
|
||||
"npm-check-updates": "^17.1.15",
|
||||
"openai": "^4.86.2",
|
||||
"pdf-lib": "^1.17.1",
|
||||
"pdf-parse": "^1.1.1",
|
||||
"pem": "^1.14.8",
|
||||
"preview-email": "^3.1.0",
|
||||
"pug": "^3.0.3",
|
||||
"rate-limiter-flexible": "^5.0.5",
|
||||
"request": "^2.88",
|
||||
"sanitize-html": "^2.14.0",
|
||||
"save": "^2.9.0",
|
||||
"sharp": "^0.33.5",
|
||||
"superagent": "^10.1.1",
|
||||
"tedious": "^18.6.1",
|
||||
"url-parse": "^1.5.10",
|
||||
"validator": "^13.7.0",
|
||||
"validator": "^13.12.0",
|
||||
"vhost": "^3.0.2",
|
||||
"web-push": "^3.6.7",
|
||||
"xml2js": "^0.6.2",
|
||||
"xoauth2": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.27.10",
|
||||
"expect": "^29.0.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-inline-css": "^2.0.0",
|
||||
"browser-sync": "^3.0.3",
|
||||
"expect": "^29.7.0",
|
||||
"gulp": "^5.0.0",
|
||||
"gulp-inline-css": "^4.0.0",
|
||||
"gulp-pug": "^5.0.0",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.1.3",
|
||||
"gulp-sass": "^5.1.0",
|
||||
"jest": "^29.0.2",
|
||||
"mocha": "^10.0.0",
|
||||
"nodemon": "^3.0.1",
|
||||
"supertest": "^6.2.4"
|
||||
"gulp-replace": "^1.1.4",
|
||||
"gulp-sass": "^6.0.1",
|
||||
"jest": "^29.7.0",
|
||||
"mocha": "^11.1.0",
|
||||
"nodemon": "^3.1.9",
|
||||
"supertest": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
source ./.env.prod.pcb
|
||||
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... /var/www/$SERVERDIR_WEBSITE/"
|
||||
echo "Sincronizzazione in corso PCB PRODUZIONE ... $SERVERDIR_WEBSITE/"
|
||||
echo ""
|
||||
|
||||
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:/var/www/$SERVERDIR_WEBSITE/
|
||||
rsync -avz -e 'ssh -p 8822' src pcbuser@pcb:$SERVERDIR_WEBSITE/
|
||||
|
||||
echo "Sincronizzazione TERMINATA! - SERVER PCB!"
|
||||
|
||||
BIN
public/upload/catalogo/Paolo_stampa_2664x3685.jpg
Normal file
|
After Width: | Height: | Size: 554 KiB |
BIN
public/upload/imgs/background_stampa.jpg
Normal file
|
After Width: | Height: | Size: 3.2 MiB |
BIN
public/upload/pages/home/gruppo_macro.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
public/upload/pages/home/logo-new-121x121_gaia_terra.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
public/upload/pages/undefined/gruppo_macro.png
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
public/upload/products/LQ_Letsee_100x1120jpeg.jpg
Normal file
|
After Width: | Height: | Size: 629 KiB |
BIN
public/upload/products/avocado2.jpg
Normal file
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 3.3 MiB |
|
After Width: | Height: | Size: 678 KiB |
53
scripts/esporta_dati.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definizione delle costanti
|
||||
targetDB="FreePlanet"
|
||||
MYDOCKER="mongodb_riso"
|
||||
|
||||
# Percorso del file da Esportare (specificare il percorso completo)
|
||||
myCollection="$1"
|
||||
fileToImport="$1.json"
|
||||
|
||||
# Leggi il nome della collezione come primo argomento
|
||||
if [ -z "$1" ]; then
|
||||
echo "Errore: Devi specificare il nome della collezione come argomento."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Leggi le credenziali dal file di configurazione
|
||||
source ~/batch/.my_cfg.ini
|
||||
|
||||
# Verifica che le variabili siano state impostate correttamente
|
||||
if [ -z "$PWDDB" ]; then
|
||||
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Messaggio di conferma
|
||||
echo "Stai per Esportare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
|
||||
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
|
||||
|
||||
# Controllo della risposta dell'utente
|
||||
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
|
||||
echo "Operazione annullata."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Esegui il comando mongoimport dentro il container Docker
|
||||
docker exec $MYDOCKER mongoexport \
|
||||
--username admin \
|
||||
--password "$PWDDB" \
|
||||
--authenticationDatabase admin \
|
||||
--db "$targetDB" \
|
||||
--collection "$myCollection" \
|
||||
--out "$fileToImport" \
|
||||
|
||||
|
||||
# Verifica lo stato dell'operazione
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Esportazione completata con successo! $fileToImport"
|
||||
else
|
||||
echo "Errore durante l'esportazione."
|
||||
exit 1
|
||||
fi
|
||||
53
scripts/importa_dati.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Definizione delle costanti
|
||||
targetDB="FreePlanet"
|
||||
MYDOCKER="mongodb_riso"
|
||||
|
||||
# Percorso del file da importare (specificare il percorso completo)
|
||||
myCollection="$1"
|
||||
fileToImport="$1.json"
|
||||
|
||||
# Leggi il nome della collezione come primo argomento
|
||||
if [ -z "$1" ]; then
|
||||
echo "Errore: Devi specificare il nome della collezione come argomento."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Leggi le credenziali dal file di configurazione
|
||||
source ~/batch/.my_cfg.ini
|
||||
|
||||
# Verifica che le variabili siano state impostate correttamente
|
||||
if [ -z "$PWDDB" ]; then
|
||||
echo "Errore: La password del database non è stata trovata in .my_cfg.ini."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Messaggio di conferma
|
||||
echo "Stai per importare i dati da '$fileToImport' nella collezione '$myCollection' del database '$targetDB'."
|
||||
read -p "Sei sicuro di voler procedere? (Y/N): " risposta
|
||||
|
||||
# Controllo della risposta dell'utente
|
||||
if [[ "$risposta" != "Y" && "$risposta" != "y" ]]; then
|
||||
echo "Operazione annullata."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Esegui il comando mongoimport dentro il container Docker
|
||||
docker exec $MYDOCKER mongoimport \
|
||||
--username admin \
|
||||
--password "$PWDDB" \
|
||||
--authenticationDatabase admin \
|
||||
--db "$targetDB" \
|
||||
--collection "$myCollection" \
|
||||
--file "$fileToImport" \
|
||||
--jsonArray
|
||||
|
||||
# Verifica lo stato dell'operazione
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Importazione completata con successo!"
|
||||
else
|
||||
echo "Errore durante l'importazione."
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "../.."
|
||||
},
|
||||
{
|
||||
"path": "../../../newfreeplanet"
|
||||
},
|
||||
{
|
||||
"path": "../../../cnm"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"search.useIgnoreFiles": false,
|
||||
"search.useParentIgnoreFiles": false,
|
||||
"files.exclude": {
|
||||
"": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,28 @@
|
||||
const tools = require('../tools/general');
|
||||
|
||||
console.log('__');
|
||||
console.log('__');
|
||||
console.log('__');
|
||||
console.log('__');
|
||||
console.log('****************************************************');
|
||||
console.log('*** AVVIO DEL SERVER NODE.JS ***');
|
||||
console.log('****************************************************');
|
||||
console.log('__');
|
||||
|
||||
if ((process.env.NODE_ENV === 'production')) {
|
||||
console.log(' *** AMBIENTE DI PRODUZIONE !!!!')
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
console.log(' *** ### AMBIENTE DI TEST ')
|
||||
} else if (process.env.NODE_ENV === 'development') {
|
||||
console.log(' *** ### AMBIENTE DI SVILUPPO (LOCALE) ')
|
||||
}
|
||||
console.log('__');
|
||||
|
||||
// still in app.js
|
||||
const node_env = process.env.NODE_ENV || 'production';
|
||||
console.log('node_env=', node_env);
|
||||
|
||||
var file = `.env.${node_env}`;
|
||||
|
||||
|
||||
// GLOBALI (Uguali per TUTTI)
|
||||
process.env.LINKVERIF_REG = '/vreg';
|
||||
process.env.LINK_REQUEST_NEWPASSWORD = '/requestnewpwd';
|
||||
@@ -22,466 +38,18 @@ require('dotenv').config({ path: file });
|
||||
process.env.DATABASE = process.env.DATABASE || 'FreePlanet';
|
||||
|
||||
console.log('process.env.DOMAIN:', process.env.DOMAIN);
|
||||
process.env.MONGODB_URI = process.env.DOMAIN + process.env.DATABASE;
|
||||
console.log('process.env.MONGODB_URI:', process.env.MONGODB_URI);
|
||||
const domain = process.env.DOMAIN;
|
||||
const username = encodeURIComponent(process.env.MONGODB_USER);
|
||||
const password = encodeURIComponent(process.env.MONGODB_PWD);
|
||||
const database = process.env.DATABASE || "test"; // Nome del database, default a 'test'
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// ---------------- AMBIENTE DI PRODUZIONE !!!!!!!!!! --------------------
|
||||
MYAPPS = [
|
||||
{
|
||||
idapp: '1',
|
||||
name: 'FreePlanet',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'paolo.arena77@gmail.com',
|
||||
host: 'https://freeplanet.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/www.freeplanet.app',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '2',
|
||||
name: 'Associazione Shen',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: 'info@associazioneshen.it',
|
||||
replyTo: 'info@associazioneshen.it',
|
||||
host: 'https://www.associazioneshen.it',
|
||||
portapp: '0',
|
||||
dir: '/var/www/associazioneshen.it',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '3',
|
||||
name: 'Brigitte MG Dumont',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'http://brigittemgdumont.com',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '4',
|
||||
name: 'Mandala Solidale',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://mandala.freeplanet.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/mandala.freeplanet.app',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '6',
|
||||
name: 'Mandala per l\'Anima',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'http://mandalaperlanima.eu',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '8',
|
||||
name: 'CentrOlistico Rimini',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'info@arcodiluce.it',
|
||||
host: 'https://www.centrolisticorimini.it',
|
||||
portapp: '0',
|
||||
dir: '/var/www/centrolisticorimini.it',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '9',
|
||||
name: 'SalviamoIlPianeta',
|
||||
adminemail: 'salviamoilpianeta2020@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://salviamoilpianeta.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/salviamoilpianeta.app',
|
||||
email_from: 'salviamoilpianeta2020@gmail.com',
|
||||
email_pwd: 'c6f63e7aba9393c73f56e338a7fe5283a73949363662d26bd375dd05b6f6f37ebkw4vINQ0O/4d8JN71aNH3UsyndeFRgyyMvJMVl4iOk=',
|
||||
telegram_key:'1202788747:AAErwzIsD7k-3Yj5AX6ci3p7ELMuyASq4vA',
|
||||
telegram_bot_name: 'SalviamoIlPianeta_bot',
|
||||
pathreg_add:'_sip',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '10',
|
||||
name: 'Comunità Nuovo Mondo',
|
||||
adminemail: 'cnmrimini@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://comunitanuovomondo.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/comunitanuovomondo.app',
|
||||
// email_from: 'info.pianetalibero@gmail.com',
|
||||
// email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
email_from: 'cnmrimini@gmail.com',
|
||||
email_pwd: '9693e200ae56f1119185a29d34079656a628f2663dc108f7d106496ac0042815F+mvJF79KcQcUnF0twoyIg==',
|
||||
telegram_key:'1646348227:AAF2qgpHB4KprhB0HPefazGLyoVGW_i4jTA',
|
||||
telegram_bot_name: 'cnm_mybot',
|
||||
pathreg_add:'_cnm',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '11',
|
||||
name: 'ArtEnergetica',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://www.artenergetica.org',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
];
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
// ---------------- AMBIENTE DI TEST --------------------
|
||||
MYAPPS = [
|
||||
{
|
||||
idapp: '1',
|
||||
name: 'FreePlanet',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'paolo.arena77@gmail.com',
|
||||
host: 'https://test.freeplanet.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/www.freeplanet.app',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '2',
|
||||
name: 'Associazione Shen',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'info@associazioneshen.it',
|
||||
host: 'http://test.associazioneshen.it',
|
||||
portapp: '0',
|
||||
dir: '/var/www/associazioneshen.it',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '3',
|
||||
name: 'Brigitte MG Dumont',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://test.brigittemgdumont.com',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '4',
|
||||
name: 'Mandala Solidale',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
host: 'https://mandala.freeplanet.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/mandalatest.freeplanet.app',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '6',
|
||||
name: 'Mandala per l\'Anima',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
host: 'http://test.mandalaperlanima.eu',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '8',
|
||||
name: 'CentrOlistico Rimini',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'info@arcodiluce.it',
|
||||
host: 'https://www.centrolisticorimini.it',
|
||||
portapp: '0',
|
||||
dir: '/var/www/centrolisticorimini.it',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '9',
|
||||
name: 'SalviamoIlPianeta (Server Test)',
|
||||
adminemail: 'info.pianetalibero@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://test.salviamoilpianeta.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/test.salviamoilpianeta.app',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'_sip',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '10',
|
||||
name: 'Comunità Nuovo Mondo (Server Test)',
|
||||
adminemail: 'info.pianetalibero@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: '',
|
||||
host: 'https://test.comunitanuovomondo.app',
|
||||
portapp: '0',
|
||||
dir: '/var/www/test.comunitanuovomondo.app',
|
||||
// email_from: 'info.pianetalibero@gmail.com',
|
||||
// email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'_cnm',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '3',
|
||||
name: 'Brigitte MG Dumont',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://test.brigittemgdumont.com',
|
||||
portapp: '0',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '11',
|
||||
name: 'ArtEnergetica',
|
||||
adminemail: '',
|
||||
manageremail: '',
|
||||
host: 'https://www.artenergetica.org',
|
||||
portapp: '0',
|
||||
dir: '/var/www/artenergetica.org',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '2df135e2b6c02b2c68ec6bf6b103751fcb4dfc48c57d0acb302482358ee8141fmaDuooPabDvlThiBI2XMyA==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
];
|
||||
if (process.env.AUTH_DB_PASSING === "1") {
|
||||
// replace username and password in the process.env.DOMAIN
|
||||
process.env.MONGODB_URI = process.env.DOMAIN_AUTH.replace('{username}', username).replace('{password}', password) + database;
|
||||
process.env.MONGODB_URI_NOPWD = process.env.DOMAIN_AUTH.replace('{username}', username) + database;
|
||||
} else {
|
||||
// ---------------- AMBIENTE IN L O C A L E --------------------
|
||||
MYAPPS = [
|
||||
{
|
||||
idapp: '1',
|
||||
name: 'FreePlanet',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'paolo.arena77@gmail.com',
|
||||
host: 'http://localhost',
|
||||
portapp: '8080',
|
||||
dir: '/home/paolo/myproject/freeplanet/dist/spa',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '2',
|
||||
name: 'Associazione Shen',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'info@associazioneshen.it',
|
||||
host: 'http://localhost',
|
||||
portapp: '8081',
|
||||
dir: '/home/paolo/myproject/associazioneShen/dist/spa',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '3',
|
||||
name: 'Brigitte',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8082',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '4',
|
||||
name: 'Mandala Solidale',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8084',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '6',
|
||||
name: 'Mandala per l\'Anima',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8083',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '8',
|
||||
name: 'CentrOlistico Rimini',
|
||||
adminemail: 'pao.loarena77@gmail.com',
|
||||
manageremail: '',
|
||||
replyTo: 'info@arcodiluce.it',
|
||||
host: 'http://localhost',
|
||||
portapp: '8086',
|
||||
dir: '/home/paolo/myproject/centrolisticorimini.it/dist/spa',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key:'',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '9',
|
||||
name: 'SalviamoIlPianeta',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8087',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
telegram_key: '',
|
||||
telegram_bot_name: '',
|
||||
|
||||
// telegram_key:'1049833543:AAE1RhGUJVdm0N_vrj0ijHZ04GCkKjl8TuQ',
|
||||
// telegram_bot_name: 'TestSalviamoIlPianeta_bot',
|
||||
pathreg_add:'_sip',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '10',
|
||||
name: 'Comunità Nuovo Mondo',
|
||||
adminemail: 'cnmrimini@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8090',
|
||||
dir: '',
|
||||
email_from: 'cnmrimini@gmail.com',
|
||||
email_pwd: 'bc61ab32a09d22e3a5097aa6668d3c724854c5856de9c713c427017bb89cdb0ctIESmuHr3FCNTLlRAK6d5Q',
|
||||
telegram_key: '',
|
||||
telegram_bot_name: '',
|
||||
pathreg_add:'_cnm',
|
||||
abilitanave: false,
|
||||
},
|
||||
{
|
||||
idapp: '11',
|
||||
name: 'ArtEnergetica',
|
||||
adminemail: 'paolo.arena77@gmail.com',
|
||||
manageremail: '',
|
||||
host: 'http://localhost',
|
||||
portapp: '8091',
|
||||
dir: '',
|
||||
email_from: 'info.pianetalibero@gmail.com',
|
||||
email_pwd: '66ffeb915e71fada64ad5c26947dd087c262be3b343734a0447c6dee534b888aZcfbjXEuMBWKxvbh60cniw==',
|
||||
pathreg_add:'',
|
||||
abilitanave: false,
|
||||
},
|
||||
];
|
||||
|
||||
process.env.MONGODB_URI = domain + database;
|
||||
process.env.MONGODB_URI_NOPWD = domain + database;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
console.log('process.env.MONGODB_URI:', process.env.MONGODB_URI_NOPWD);
|
||||
|
||||
27
src/server/config/database-sqlsrv.js.off
Normal file
@@ -0,0 +1,27 @@
|
||||
require("dotenv").config();
|
||||
const { Sequelize } = require("sequelize");
|
||||
|
||||
const sequelize = new Sequelize(process.env.DB_DATABASE_SQLSRVTEST, process.env.DB_USERNAME_SQLSRVTEST, process.env.DB_PASSWORD_SQLSRVTEST, {
|
||||
host: process.env.DB_HOST_SQLSRVTEST || "localhost",
|
||||
port: process.env.DB_PORT_SQLSRVTEST || 1433,
|
||||
dialect: "mssql",
|
||||
dialectOptions: {
|
||||
options: {
|
||||
encrypt: false, // Cambia a true se usi SSL
|
||||
},
|
||||
},
|
||||
logging: false, // Disabilita il logging delle query
|
||||
});
|
||||
|
||||
async function testConnection() {
|
||||
try {
|
||||
await sequelize.authenticate();
|
||||
console.log("Connessione al database riuscita!");
|
||||
} catch (error) {
|
||||
console.error("Errore nella connessione al database:", error);
|
||||
}
|
||||
}
|
||||
|
||||
testConnection();
|
||||
|
||||
module.exports = sequelize;
|
||||
959
src/server/controllers/articleController.js
Normal file
@@ -0,0 +1,959 @@
|
||||
const server_constants = require('../tools/server_constants');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const axios = require('axios');
|
||||
|
||||
const T_Web_Articoli = require('../models/t_web_articoli');
|
||||
const T_Web_StatiProdotto = require('../models/t_web_statiprodotto');
|
||||
const T_Web_TipiFormato = require('../models/t_web_tipiformato');
|
||||
|
||||
const SERVER_A_URL = process.env.SERVER_A_URL || "";
|
||||
const API_KEY = process.env.API_KEY_MSSQL;
|
||||
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
|
||||
// Funzione per ottenere i dati
|
||||
const getArticlesSales = async () => {
|
||||
try {
|
||||
const query = `
|
||||
SELECT
|
||||
a.IdArticolo, a.Titolo, a.DataPubblicazione, a.Ean13 AS isbn,
|
||||
a.IdCollana, y.DescrizioneCollana, i2.DescrArgomento, a.ListaArgomenti,
|
||||
a.Pagine, a.IdTipoFormato, a.Misure,
|
||||
COALESCE(o.totVen, 0) as totVen, COALESCE(u.totFat, 0) as totFat,
|
||||
COALESCE(p.rank3M, 0) as rank3M, COALESCE(t.fatrank3M, 0) as fatrank3M,
|
||||
COALESCE(q.rank6M, 0) as rank6M, COALESCE(r.rank1Y, 0) as rank1Y,
|
||||
COALESCE(t.fat3mesi, 0) as fatLast3M,
|
||||
COALESCE(t2.fat6mesi, 0) as fatLast6M,
|
||||
COALESCE(p.venduti3mesi, 0) as vLast3M,
|
||||
COALESCE(q.venduti6mesi, 0) as vLast6M, COALESCE(r.venduti1anno, 0) as vLast1Y,
|
||||
s.ultimoOrdine as dataUltimoOrdine
|
||||
FROM T_WEB_Articoli a
|
||||
LEFT JOIN (SELECT CodArticoloGM, SUM(Qta) as totVen FROM T_WEB_Ordini GROUP BY CodArticoloGM) o
|
||||
ON a.IdArticolo = o.CodArticoloGM
|
||||
LEFT JOIN (SELECT CodArticolo, SUM(TRY_CAST(Qta AS INT)) as totFat FROM T_WEB_ArticoliFatturati WHERE ISNUMERIC(Qta) = 1 GROUP BY CodArticolo) u
|
||||
ON a.IdArticolo = u.CodArticolo
|
||||
WHERE a.IdStatoProdotto IS NOT NULL
|
||||
ORDER BY totVen DESC;
|
||||
`;
|
||||
|
||||
const response = await axios.post(SERVER_A_URL + '/query', { query }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
|
||||
return response.data || [];
|
||||
|
||||
} catch (error) {
|
||||
console.error("Errore nel recupero degli articoli:", error);
|
||||
throw new Error("Errore nel recupero degli articoli venduti.");
|
||||
}
|
||||
};
|
||||
|
||||
// Endpoint per ottenere i dati in formato JSON
|
||||
exports.getArticlesSalesHandler = async (req, res) => {
|
||||
try {
|
||||
const data = await getArticlesSales();
|
||||
if (!data.length) return res.status(404).json({ message: "Nessun articolo trovato." });
|
||||
res.json(data);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
// Endpoint per esportare i dati come file JSON
|
||||
exports.exportArticlesSalesByJSON = async (req, res) => {
|
||||
try {
|
||||
const data = await getArticlesSales();
|
||||
if (!data.length) return res.status(404).json({ message: "Nessun articolo trovato." });
|
||||
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
res.setHeader("Content-Disposition", `attachment; filename="ranking_articles_${new Date().toISOString().split('T')[0]}.json"`);
|
||||
res.json(data);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
exports.getTableContent = async (options) => {
|
||||
try {
|
||||
// Chiama getTableContent, se ritorna errore hangup, allora attendi 2 secondi e poi richiamala.
|
||||
const tableContent = await this.getTableContentBase(options);
|
||||
console.log(' uscito dalla funzione getTableContentBase ... ')
|
||||
return tableContent;
|
||||
} catch (error) {
|
||||
console.error('Error: ', error?.message);
|
||||
if (error.message === 'socket hang up') {
|
||||
console.log('Error: hangup, waiting 2 seconds and retrying...');
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
return await this.getTableContent(options);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
exports.formatDate = (dateValue) => {
|
||||
const date = new Date(dateValue);
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const year = date.getFullYear();
|
||||
return `${day}/${month}/${year}`;
|
||||
};
|
||||
|
||||
exports.getModelByNameTable = (nameTable) => {
|
||||
switch (nameTable) {
|
||||
case 'T_Web_Articoli':
|
||||
return T_Web_Articoli;
|
||||
case 'T_Web_StatiProdotto':
|
||||
return T_Web_StatiProdotto;
|
||||
case 'T_Web_TipiFormato':
|
||||
return T_Web_TipiFormato;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
exports.getTableContentBase = async (options) => {
|
||||
try {
|
||||
const myurl = SERVER_A_URL + '/query';
|
||||
console.log('getTableContentBase...', myurl)
|
||||
// Verifica se la tabella esiste
|
||||
const checkTableQuery = `SELECT COUNT(*) as tableExists FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '${options.nameTable}'`;
|
||||
const checkResponse = await axios.post(myurl, { query: checkTableQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
console.log(' risposta 1...')
|
||||
if (!checkResponse?.data || checkResponse?.data.length === 0 || checkResponse?.data[0].tableExists === 0) {
|
||||
return `La tabella '${options.nameTable}' non esiste.`;
|
||||
}
|
||||
|
||||
// Recupera le colonne della tabella principale dal catalogo
|
||||
const columnsQuery = `SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '${options.nameTable}'`;
|
||||
const columnsResponse = await axios.post(SERVER_A_URL + '/query', { query: columnsQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
console.log(' risposta 2 (schema)...')
|
||||
const tableColumns = columnsResponse.data.map(col => col.COLUMN_NAME);
|
||||
|
||||
// Mappatura per unire i campi (ID e Descrizione)
|
||||
const mergedMapping = {
|
||||
"IdStatoProdotto": "DescrizioneStatoProdotto",
|
||||
"IdTipologia": "DescrizioneTipologia",
|
||||
"IdTipoFormato": "DescrizioneFormato",
|
||||
"IdCollana": "DescrizioneCollana",
|
||||
"ListaArgomenti": "DescrArgomento",
|
||||
"ListaAutori": "AutoriCompleti",
|
||||
"IdMarchioEditoriale": "CasaEditrice",
|
||||
};
|
||||
|
||||
// Costruisce la query per recuperare i record
|
||||
let dataQuery = "";
|
||||
|
||||
let records = [];
|
||||
|
||||
if (options?.usaDBGMLocale) {
|
||||
|
||||
// Cerca il modello corrispondente alla tabella se esiste
|
||||
let mymodel = this.getModelByNameTable(options.nameTable);
|
||||
if (!mymodel) {
|
||||
// fai una query sul db locale mongodb dela tabella chiamata "options.nameTable"
|
||||
mymodel = mongoose.model(options.nameTable, new mongoose.Schema({}, { strict: false }));
|
||||
if (!mymodel)
|
||||
return `Il modello per la tabella '${options.nameTable}' non esiste.`;
|
||||
}
|
||||
|
||||
if (options.aggregation) {
|
||||
console.log('options.aggregation', options.aggregation);
|
||||
records = await mymodel.aggregate(options.aggregation);
|
||||
|
||||
} else {
|
||||
const pipeline = [];
|
||||
|
||||
// Filtro base se specificato
|
||||
if (options.where) {
|
||||
const whereConditions = options.where;
|
||||
pipeline.push({ $match: whereConditions });
|
||||
}
|
||||
|
||||
if (options.sort) {
|
||||
pipeline.push({ $sort: options.sort });
|
||||
}
|
||||
|
||||
if (options.limit) {
|
||||
pipeline.push({ $limit: options.limit });
|
||||
}
|
||||
|
||||
// Selezione dei campi
|
||||
if (options.fieldGM) {
|
||||
pipeline.push({ $project: { [options.fieldGM]: 1 } });
|
||||
}
|
||||
|
||||
console.log(' aggregate pipeline...', pipeline);
|
||||
records = await mymodel.aggregate(pipeline);
|
||||
}
|
||||
|
||||
console.log('results', records ? records[0] : ' non ricevuto');
|
||||
|
||||
} else {
|
||||
|
||||
let columnsToShow = 'T.*';
|
||||
if (options.fieldGM) {
|
||||
columnsToShow = 'T.' + options.fieldGM;
|
||||
}
|
||||
|
||||
if (options.nameTable.toLowerCase() === 't_web_articoli') {
|
||||
if (true) {
|
||||
dataQuery = `
|
||||
SELECT TOP ${options.numrec || 10000}
|
||||
${columnsToShow}
|
||||
` + (options.campispeciali ? `
|
||||
,f.DescrizioneStatoProdotto
|
||||
,i.DescrizioneTipologia
|
||||
,n.DescrizioneFormato
|
||||
,y.DescrizioneCollana
|
||||
,z.AutoriCompleti
|
||||
,i2.DescrArgomento
|
||||
,z3.CasaEditrice` : ``) + (options.showQtaDisponibile ? ` ,q.QtaDisponibile ` : ``) +
|
||||
` FROM T_WEB_Articoli T
|
||||
JOIN(
|
||||
SELECT IdArticolo, MAX(DataOra) AS data
|
||||
FROM T_WEB_Articoli
|
||||
GROUP BY IdArticolo
|
||||
) b ON T.IdArticolo = b.IdArticolo AND T.DataOra = b.data `
|
||||
+ (options.campispeciali ?
|
||||
` LEFT JOIN(
|
||||
SELECT e.IdStatoProdotto, e.Descrizione as DescrizioneStatoProdotto
|
||||
FROM T_WEB_StatiProdotto e
|
||||
JOIN(
|
||||
SELECT IdStatoProdotto, MAX(DataOra) as data1
|
||||
FROM T_WEB_StatiProdotto
|
||||
GROUP BY IdStatoProdotto
|
||||
) c ON e.IdStatoProdotto = c.IdStatoProdotto AND e.DataOra = c.data1
|
||||
) f ON T.IdStatoProdotto = f.IdStatoProdotto
|
||||
LEFT JOIN(
|
||||
SELECT g.IdTipologia, g.Descrizione as DescrizioneTipologia
|
||||
FROM T_WEB_Tipologie g
|
||||
JOIN(
|
||||
SELECT IdTipologia, MAX(DataOra) as data1
|
||||
FROM T_WEB_Tipologie
|
||||
GROUP BY IdTipologia
|
||||
) h ON g.IdTipologia = h.IdTipologia AND g.DataOra = h.data1
|
||||
) i ON T.IdTipologia = i.IdTipologia
|
||||
LEFT JOIN(
|
||||
SELECT l.IdTipoFormato, l.Descrizione as DescrizioneFormato
|
||||
FROM T_WEB_TipiFormato l
|
||||
JOIN(
|
||||
SELECT IdTipoFormato, MAX(DataOra) as data1
|
||||
FROM T_WEB_TipiFormato
|
||||
GROUP BY IdTipoFormato
|
||||
) m ON l.IdTipoFormato = m.IdTipoFormato AND l.DataOra = m.data1
|
||||
) n ON T.IdTipoFormato = n.IdTipoFormato
|
||||
LEFT JOIN(
|
||||
SELECT v.IdCollana, v.Descrizione as DescrizioneCollana
|
||||
FROM T_WEB_Collane v
|
||||
INNER JOIN(
|
||||
SELECT IdCollana, MAX(ID) as MaxID
|
||||
FROM T_WEB_Collane
|
||||
GROUP BY IdCollana
|
||||
) x ON v.IdCollana = x.IdCollana AND v.ID = x.MaxID
|
||||
) y ON T.IdCollana = y.IdCollana
|
||||
LEFT JOIN(
|
||||
SELECT g2.IdArgomento, g2.Descrizione as DescrArgomento
|
||||
FROM T_WEB_Argomenti g2
|
||||
INNER JOIN(
|
||||
SELECT IdArgomento, MAX(DataOra) as data12
|
||||
FROM T_WEB_Argomenti
|
||||
GROUP BY IdArgomento
|
||||
) h ON g2.IdArgomento = h.IdArgomento AND g2.DataOra = h.data12
|
||||
) i2 ON T.ListaArgomenti = i2.IdArgomento
|
||||
LEFT JOIN(
|
||||
SELECT
|
||||
T1.IdArticolo,
|
||||
STUFF((
|
||||
SELECT ',' + ISNULL(A2.AutoreCompleto, '')
|
||||
FROM(
|
||||
SELECT CAST('<root><x>' + REPLACE(T1.ListaAutori, ',', '</x><x>') + '</x></root>' AS XML) AS DataXML
|
||||
) X
|
||||
CROSS APPLY X.DataXML.nodes('/root/x') AS A(x)
|
||||
CROSS APPLY(
|
||||
SELECT TRY_CAST(LTRIM(RTRIM(A.x.value('.', 'VARCHAR(100)'))) AS INT) AS AutoreID
|
||||
) CA
|
||||
JOIN(
|
||||
SELECT a.IdAutore, CONCAT(a.Nome, ' ', a.Cognome) AS AutoreCompleto
|
||||
FROM T_WEB_Autori a
|
||||
JOIN(
|
||||
SELECT IdAutore, MAX(DataOra) AS maxData
|
||||
FROM T_WEB_Autori
|
||||
GROUP BY IdAutore
|
||||
) aa ON a.IdAutore = aa.IdAutore AND a.DataOra = aa.maxData
|
||||
) A2 ON CA.AutoreID = A2.IdAutore
|
||||
FOR XML PATH(''), TYPE
|
||||
).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS AutoriCompleti
|
||||
FROM T_WEB_Articoli T1
|
||||
GROUP BY T1.IdArticolo, T1.ListaAutori
|
||||
) z ON T.IdArticolo = z.IdArticolo
|
||||
LEFT JOIN(
|
||||
SELECT a3.IdMarchioEditoriale, a3.Descrizione as CasaEditrice
|
||||
FROM T_WEB_MarchiEditoriali a3
|
||||
JOIN(
|
||||
SELECT IdMarchioEditoriale, MAX(DataOra) as maxData
|
||||
FROM T_WEB_MarchiEditoriali
|
||||
GROUP BY IdMarchioEditoriale
|
||||
) aa3 ON a3.IdMarchioEditoriale = aa3.IdMarchioEditoriale AND a3.DataOra = aa3.maxData
|
||||
) z3 ON T.IdMarchioEditoriale = z3.IdMarchioEditoriale `
|
||||
: ``)
|
||||
+ (options.showQtaDisponibile ?
|
||||
` LEFT JOIN(
|
||||
SELECT o.Codice, o.QtaDisponibile
|
||||
FROM T_WEB_Disponibile o
|
||||
JOIN(
|
||||
SELECT Codice, MAX(DataOra) as data1
|
||||
FROM T_WEB_Disponibile
|
||||
GROUP BY Codice
|
||||
) p ON o.Codice = p.Codice AND o.DataOra = p.data1
|
||||
) q ON T.IdArticolo = q.Codice` : ``)
|
||||
} else {
|
||||
dataQuery += `
|
||||
SELECT TOP ${options.numrec}
|
||||
T.*
|
||||
FROM T_WEB_Articoli T
|
||||
JOIN(
|
||||
SELECT IdArticolo, MAX(DataOra) AS data
|
||||
FROM T_WEB_Articoli
|
||||
GROUP BY IdArticolo
|
||||
) b ON T.IdArticolo = b.IdArticolo AND T.DataOra = b.data
|
||||
`;
|
||||
}
|
||||
} else {
|
||||
dataQuery = `SELECT TOP ${options.numrec || 10000} * FROM ${options.nameTable} `;
|
||||
}
|
||||
if (options.where && options.where.trim() !== "") {
|
||||
dataQuery += ` WHERE ${options.where} `;
|
||||
}
|
||||
|
||||
console.log('dataQuery', dataQuery);
|
||||
|
||||
// Esegue la query per recuperare i dati
|
||||
// console.log('dataQuery', dataQuery);
|
||||
const dataResponse = await axios.post(SERVER_A_URL + '/query', { query: dataQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
|
||||
records = dataResponse?.data;
|
||||
}
|
||||
|
||||
if (!records || records.length === 0) {
|
||||
console.log(`Nessun record trovato per la tabella ${options.nameTable}.`);
|
||||
return [];
|
||||
}
|
||||
|
||||
// Determina quali colonne visualizzare.
|
||||
let displayColumns;
|
||||
if (options.nameTable.toLowerCase() === 't_web_articoli') {
|
||||
// Usa tutte le proprietà del record, escludendo le colonne dei campi uniti (quelle usate per il merge)
|
||||
displayColumns = Object.keys(records[0]).filter(col => !Object.values(mergedMapping).includes(col));
|
||||
} else {
|
||||
displayColumns = tableColumns;
|
||||
}
|
||||
|
||||
// Funzione per ottenere il valore da visualizzare, fondendo i campi se presente nella mappatura
|
||||
const getDisplayValue = (record, col) => {
|
||||
let value = record[col] ?? 'NULL';
|
||||
// Format date solo se il nome della colonna indica una data/ora
|
||||
if ((col.toLowerCase().includes("data") || col.toLowerCase().includes("ora")) && value !== 'NULL') {
|
||||
if (value.includes(',')) {
|
||||
// Se ci sono più valori separati da virgola, formatta ciascuno se è una data valida
|
||||
value = value.split(',')
|
||||
.map(item => {
|
||||
const trimmed = item.trim();
|
||||
const parsed = Date.parse(trimmed);
|
||||
return !isNaN(parsed) ? this.formatDate(trimmed) : trimmed;
|
||||
})
|
||||
.join(', ');
|
||||
} else {
|
||||
const parsed = Date.parse(value);
|
||||
if (!isNaN(parsed)) {
|
||||
value = this.formatDate(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mergedMapping[col]) {
|
||||
return `${record[mergedMapping[col]] || ''} (${value})`;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
// Costruisce l'output HTML
|
||||
let output = "";
|
||||
if (options.outhtml) {
|
||||
if (records.length === 1) {
|
||||
// Se c'è un solo record, visualizza una lista di chiavi e valori
|
||||
const record = records[0];
|
||||
output += `
|
||||
<table border='1' style="border-collapse: collapse;" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="padding: 8px; background-color: #f2f2f2;">Campo</th>
|
||||
<th style="padding: 8px; background-color: #f2f2f2;">Valore</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`;
|
||||
displayColumns.forEach(column => {
|
||||
output += `
|
||||
<tr>
|
||||
<td style="padding: 8px;">${column}</td>
|
||||
<td style="padding: 8px;">${getDisplayValue(record, column)}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
output += `
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
} else {
|
||||
// Se ci sono più record, visualizza una tabella con intestazioni
|
||||
output += "<table border='1' style='border-collapse: collapse; width: 100%;'><thead><tr>";
|
||||
displayColumns.forEach(column => {
|
||||
output += `< th style = "padding: 8px; background-color: #f2f2f2;" > ${column}</th > `;
|
||||
});
|
||||
output += "</tr></thead><tbody>";
|
||||
records.forEach(record => {
|
||||
output += "<tr>";
|
||||
displayColumns.forEach(column => {
|
||||
output += `< td style = "padding: 8px;" > ${getDisplayValue(record, column)}</td > `;
|
||||
});
|
||||
output += "</tr>";
|
||||
});
|
||||
output += "</tbody></table>";
|
||||
}
|
||||
} else {
|
||||
// solo dati
|
||||
output = {};
|
||||
|
||||
if (options.fieldGM) {
|
||||
if (records && records.length === 1) {
|
||||
output[options.fieldGM] = records[0][options.fieldGM];
|
||||
}
|
||||
} else {
|
||||
output = [];
|
||||
records.forEach(record => {
|
||||
let myrec = {}
|
||||
|
||||
if (options.recordraw) {
|
||||
myrec = record;
|
||||
} else {
|
||||
|
||||
displayColumns.forEach(column => {
|
||||
const value = record[column];
|
||||
if (value !== undefined && value !== null) {
|
||||
const type = typeof value;
|
||||
if (type === 'number' && !mergedMapping[column]) {
|
||||
myrec[column] = value;
|
||||
} else if (type === 'boolean') {
|
||||
myrec[column] = value;
|
||||
} else if (value instanceof Date) {
|
||||
myrec[column] = this.formatDate(value);
|
||||
} else {
|
||||
myrec[column] = `${getDisplayValue(record, column)}`.trim();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
output.push(myrec)
|
||||
});
|
||||
}
|
||||
}
|
||||
return output;
|
||||
|
||||
} catch (error) {
|
||||
output = `${error?.response?.data?.error || error?.stack || error.message}`;
|
||||
console.error("Errore nel recupero della tabella: ", `${error.response.data.error || error.stack || error.message}`);
|
||||
if (options.outhtml) {
|
||||
output = `
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Errore nel Recupero della Tabella ${options.nameTable}</title>
|
||||
<style>
|
||||
body {
|
||||
font - family: Arial, sans-serif;
|
||||
background-color: #f7f7f7;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
}
|
||||
.error-container {
|
||||
background - color: #ffe6e6;
|
||||
border: 1px solid #ff4d4d;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
.error-title {
|
||||
font - size: 24px;
|
||||
font-weight: bold;
|
||||
color: #d8000c;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.error-message {
|
||||
font - size: 16px;
|
||||
white-space: pre-wrap;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<div class="error-title">Errore nel Recupero della Tabella ${options.nameTable} con query: ${options.where}</div>
|
||||
<div class="error-message">
|
||||
${error.response.data.error || error.stack || error.message}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
}
|
||||
return output;
|
||||
// throw new Error("Errore nel recupero della tabella.");
|
||||
}
|
||||
};
|
||||
|
||||
const setTableContent = async (options) => {
|
||||
try {
|
||||
// checkPermissions()
|
||||
|
||||
const esegui = true
|
||||
|
||||
if (esegui) {
|
||||
|
||||
// Verifica se la tabella esiste
|
||||
const checkTableQuery = `SELECT COUNT(*) as tableExists FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '${options.nameTable}'`;
|
||||
const checkResponse = await axios.post(SERVER_A_URL + '/query', { query: checkTableQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
|
||||
if (!checkResponse.data || checkResponse.data.length === 0 || checkResponse.data[0].tableExists === 0) {
|
||||
return `La tabella '${options.nameTable}' non esiste.`;
|
||||
}
|
||||
|
||||
// Costruisce la query per inserire o aggiornare i record
|
||||
let dataQuery = "";
|
||||
if (options.insertMode) {
|
||||
// Modalità INSERT
|
||||
const columns = Object.keys(options.data);
|
||||
const values = columns.map(col => `'${options.data[col]}'`).join(", ");
|
||||
dataQuery = `
|
||||
INSERT INTO ${options.nameTable} (${columns.join(", ")})
|
||||
VALUES (${values});
|
||||
`;
|
||||
} else {
|
||||
// Modalità UPDATE
|
||||
const updateFields = Object.keys(options.data)
|
||||
.map(col => `${col} = '${options.data[col]}'`)
|
||||
.join(", ");
|
||||
const whereClause = options.where ? `WHERE ${options.where}` : "";
|
||||
dataQuery = `
|
||||
UPDATE ${options.nameTable}
|
||||
SET ${updateFields}
|
||||
${whereClause};
|
||||
`;
|
||||
}
|
||||
|
||||
console.log('dataQuery', dataQuery);
|
||||
|
||||
// Esegue la query per inserire o aggiornare i dati
|
||||
const dataResponse = await axios.post(SERVER_A_URL + '/query', { query: dataQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
|
||||
if (dataResponse.data && dataResponse.data.affectedRows > 0) {
|
||||
return `Operazione completata con successo su '${options.nameTable}'.`;
|
||||
} else {
|
||||
return `Nessun record modificato nella tabella '${options.nameTable}'.`;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Errore nell'inserimento o aggiornamento della tabella: ", error.message);
|
||||
if (options.outhtml) {
|
||||
output = `
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Errore nell'inserimento o aggiornamento della Tabella ${options.nameTable}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f7f7f7;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
}
|
||||
.error-container {
|
||||
background-color: #ffe6e6;
|
||||
border: 1px solid #ff4d4d;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
.error-title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #d8000c;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.error-message {
|
||||
font-size: 16px;
|
||||
white-space: pre-wrap;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<div class="error-title">Errore nell'inserimento o aggiornamento della Tabella ${options.nameTable}</div>
|
||||
<div class="error-message">
|
||||
${error.response.data.error || error.stack || error.message}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
return output;
|
||||
}
|
||||
return "Errore nell'inserimento o aggiornamento della tabella.";
|
||||
}
|
||||
};
|
||||
const checkPermissions = async (options) => {
|
||||
try {
|
||||
const dataQuery = `
|
||||
SELECT
|
||||
dp.name AS UserName,
|
||||
dp.type_desc AS UserType,
|
||||
o.name AS ObjectName,
|
||||
p.permission_name,
|
||||
p.state_desc AS PermissionState
|
||||
FROM
|
||||
sys.database_permissions p
|
||||
JOIN
|
||||
sys.objects o ON p.major_id = o.object_id
|
||||
JOIN
|
||||
sys.database_principals dp ON p.grantee_principal_id = dp.principal_id
|
||||
WHERE
|
||||
o.name = 'T_WEB_Articoli';
|
||||
`;
|
||||
|
||||
console.log('checkPermissions query:', dataQuery);
|
||||
|
||||
// Esegue la query per inserire o aggiornare i dati
|
||||
const dataResponse = await axios.post(SERVER_A_URL + '/query', { query: dataQuery }, {
|
||||
headers: { 'x-api-key': API_KEY }
|
||||
});
|
||||
|
||||
console.log('checkPermissions result:', dataResponse.data);
|
||||
|
||||
if (dataResponse.data && dataResponse.data.affectedRows > 0) {
|
||||
return `Operazione completata con successo.`;
|
||||
} else {
|
||||
return `Nessun permesso.`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Errore nel check dei Permessi: ", error.message);
|
||||
if (options.outhtml) {
|
||||
output = `
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Errore nell'inserimento o aggiornamento della Tabella ${options.nameTable}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f7f7f7;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
}
|
||||
.error-container {
|
||||
background-color: #ffe6e6;
|
||||
border: 1px solid #ff4d4d;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
}
|
||||
.error-title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #d8000c;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.error-message {
|
||||
font-size: 16px;
|
||||
white-space: pre-wrap;
|
||||
background: #fff;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error-container">
|
||||
<div class="error-title">Errore nell'inserimento o aggiornamento della Tabella ${options.nameTable}</div>
|
||||
<div class="error-message">
|
||||
${error.response.data.error || error.stack || error.message}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
return output;
|
||||
}
|
||||
return "Errore nell'inserimento o aggiornamento della tabella.";
|
||||
}
|
||||
};
|
||||
|
||||
// Endpoint per mostrare i dati della tabella
|
||||
exports.viewTable = async (req, res) => {
|
||||
try {
|
||||
const options = req.body.options;
|
||||
const tableContent = await this.getTableContent(options);
|
||||
|
||||
let out = {};
|
||||
|
||||
if (options.outhtml) {
|
||||
out = `
|
||||
<h2 class="text-center">Tabella: ${options.nameTable}</h2>
|
||||
<div class="text-h7 row justify-center text-blue">Query: ${options.where}<br></div>
|
||||
<div class="row justify-center">
|
||||
${tableContent}
|
||||
</div>
|
||||
`
|
||||
} else {
|
||||
out = tableContent;
|
||||
}
|
||||
|
||||
if (tableContent && tableContent.length > 0) {
|
||||
if (options.updatelocaldb) {
|
||||
this.updateLocalDb(tableContent[0], options)
|
||||
}
|
||||
}
|
||||
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, data: out });
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error: ', error);
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, error });
|
||||
}
|
||||
};
|
||||
|
||||
exports.updateLocalDb = async (tableContent, options) => {
|
||||
try {
|
||||
|
||||
const ProductInfo = require('../models/productInfo');
|
||||
const CatProd = require('../models/catprod');
|
||||
|
||||
let recproductInfo = {
|
||||
code: tableContent.Ean13.trim(),
|
||||
};
|
||||
|
||||
let risrecUpdated = null;
|
||||
|
||||
const recfound = await ProductInfo.findOne({ code: recproductInfo.code }).lean();
|
||||
if (recfound) {
|
||||
|
||||
ListaArgomenti = tableContent.ListaArgomenti;
|
||||
|
||||
let arrayPulito = ListaArgomenti
|
||||
.trim() // Rimuove gli spazi all'inizio e alla fine
|
||||
.replace(/[\(\)]/g, '') // Rimuove le parentesi tonde
|
||||
.split(','); // Divide la stringa in un array usando la virgola come separatore
|
||||
|
||||
if (arrayPulito && arrayPulito.length > 0) {
|
||||
let aggiornacat = false;
|
||||
const precCatProds = recfound.idCatProds;
|
||||
let reccatprods = [];
|
||||
for (let i = 0; i < arrayPulito.length; i++) {
|
||||
const idArgomento = parseInt(arrayPulito[i]);
|
||||
reccateg = await CatProd.findOne({ idArgomento }).lean();
|
||||
|
||||
if (reccateg) {
|
||||
// aggiungi solo se non esiste già
|
||||
if (!reccatprods.includes(reccateg._id)) {
|
||||
reccatprods.push(reccateg._id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ora controlla se l'array reccatprods e' diverso da precCatProds
|
||||
if (reccatprods.length !== precCatProds.length) {
|
||||
aggiornacat = true;
|
||||
} else {
|
||||
for (let i = 0; i < reccatprods.length; i++) {
|
||||
if (reccatprods[i].toString() !== precCatProds[i].toString()) {
|
||||
aggiornacat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (aggiornacat) {
|
||||
recproductInfo.idCatProds = reccatprods;
|
||||
aggiorna = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (tableContent.DataPubblicazione.trim()) {
|
||||
recproductInfo.date_pub = new Date(tools.convertiDataItaliana(tableContent.DataPubblicazione.trim()).date);
|
||||
// convert data to timestamp
|
||||
recproductInfo.date_pub_ts = recproductInfo.date_pub.getTime();
|
||||
aggiorna = true;
|
||||
}
|
||||
|
||||
if (aggiorna) {
|
||||
risrecUpdated = await ProductInfo.findOneAndUpdate({ code: recproductInfo.code }, { $set: recproductInfo }, { new: true, upsert: true });
|
||||
}
|
||||
|
||||
return risrecUpdated;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Error: ', e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Endpoint per mostrare i dati della tabella
|
||||
exports.queryTable = async (req, res) => {
|
||||
try {
|
||||
const options = req.body.options;
|
||||
const tableContent = await this.getTableContent(options);
|
||||
|
||||
let out = {};
|
||||
|
||||
if (options.outhtml) {
|
||||
out = `
|
||||
<h2>Tabella: ${options.nameTable}</h2>
|
||||
<div class="text-h7 row justify-center text-blue">Query: ${options.where}<br></div>
|
||||
${tableContent}
|
||||
`
|
||||
} else {
|
||||
out = tableContent;
|
||||
}
|
||||
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, data: out });
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error: ', error);
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, error });
|
||||
}
|
||||
};
|
||||
// Endpoint per salvare i dati di una tabella
|
||||
exports.saveTable = async (req, res) => {
|
||||
try {
|
||||
const options = req.body.options;
|
||||
const tableContent = await setTableContent(options);
|
||||
|
||||
let out = {};
|
||||
|
||||
if (options.outhtml) {
|
||||
out = `
|
||||
<h2 class="text-center">Tabella: ${options.nameTable}</h2>
|
||||
<div class="text-h7 row justify-center text-blue">Query: ${options.where}<br></div>
|
||||
<div class="row justify-center">
|
||||
${tableContent}
|
||||
</div>
|
||||
`
|
||||
} else {
|
||||
out = tableContent;
|
||||
}
|
||||
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, data: out });
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error: ', error);
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, error });
|
||||
}
|
||||
};
|
||||
|
||||
exports.mssqlmigrateTables = async (req) => {
|
||||
const MssqlMigrator = require('../modules/MssqlMigrator'); // Importa la classe Macro
|
||||
|
||||
try {
|
||||
const options = req.body.mydata.options;
|
||||
let listaTabelle = [];
|
||||
if (options?.parte1 || options?.tutte) {
|
||||
listaTabelle.push({ table: 'T_WEB_TitoliOriginali', usaDataOra: true, fieldId: 'IdTitoloOriginale' });
|
||||
listaTabelle.push({ table: 'T_WEB_TestateOrdini', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WEB_Ordini', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WOO_TestateOrdini', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WOO_Ordini', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WEB_Articoli', usaDataOra: true, fieldId: 'IdArticolo' });
|
||||
}
|
||||
if (options?.parte2 || options?.tutte) {
|
||||
listaTabelle.push({ table: 'T_WEB_Disponibile', usaDataOra: true, fieldId: 'Codice' });
|
||||
listaTabelle.push({ table: 'T_WEB_Argomenti', usaDataOra: true, fieldId: 'IdArgomento' });
|
||||
listaTabelle.push({ table: 'T_WEB_ClientiInternet', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WOO_Clienti', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WEB_Autori', usaDataOra: true, fieldId: 'IdAutore' });
|
||||
}
|
||||
if (options?.parte3 || options?.tutte) {
|
||||
listaTabelle.push({ table: 'T_WEB_Collane', usaDataOra: true, fieldId: 'IdCollana' });
|
||||
listaTabelle.push({ table: 'T_WEB_MarchiEditoriali', usaDataOra: true, fieldId: 'IdMarchioEditoriale' });
|
||||
listaTabelle.push({ table: 'T_WEB_StatiProdotto', usaDataOra: true, fieldId: 'IdStatoProdotto' });
|
||||
listaTabelle.push({ table: 'T_WEB_TipiFormato', usaDataOra: true, fieldId: 'IdTipoFormato' });
|
||||
listaTabelle.push({ table: 'T_WEB_Tipologie', usaDataOra: true, fieldId: 'IdTipologia' });
|
||||
listaTabelle.push({ table: 'T_WEB_ArticoliFatturati', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WEB_IdInternetFatturati', usaDataOra: false });
|
||||
listaTabelle.push({ table: 'T_WEB_Edizioni', usaDataOra: true, fieldId: 'IdEdizione' });
|
||||
listaTabelle.push({ table: 'T_WEB_Contratti', usaDataOra: true, fieldId: 'IdArticolo' });
|
||||
}
|
||||
if (options?.test) {
|
||||
listaTabelle.push({ table: 'T_WEB_Articoli', usaDataOra: true, fieldId: 'IdArticolo' });
|
||||
}
|
||||
|
||||
const migrator = new MssqlMigrator();
|
||||
return await migrator.migrateTables(listaTabelle);
|
||||
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
return 'Errore: ' + e.message
|
||||
}
|
||||
|
||||
};
|
||||
exports.updateAllBook = async (idapp, options) => {
|
||||
|
||||
const Macro = require('../modules/Macro'); // Importa la classe Macro
|
||||
|
||||
try {
|
||||
const macro = new Macro(idapp); // Crea un'istanza della classe Macro
|
||||
options.idapp = idapp;
|
||||
return await macro.updateLocalDbFromGM_T_Web_Articoli(options);
|
||||
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
return e.message;
|
||||
}
|
||||
};
|
||||
|
||||
exports.updateAllBookRoute = async (req, res) => {
|
||||
|
||||
try {
|
||||
const idapp = req.body.idapp;
|
||||
const options = req.body.options;
|
||||
const result = await this.updateAllBook(idapp, options);
|
||||
|
||||
return res.status(200).send({ data: result });
|
||||
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
if (res) {
|
||||
return res.status(400).send(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63583,7 +63583,7 @@ module.exports = {
|
||||
{
|
||||
_id: 5782,
|
||||
istat: '030096',
|
||||
comune: 'Rivignano',
|
||||
comune: 'Rivignano Teor',
|
||||
prov: 'UD',
|
||||
reg: 'FVG',
|
||||
pref: '0432',
|
||||
|
||||
@@ -1,75 +1,84 @@
|
||||
var mongoose = require('mongoose').set('debug', false)
|
||||
var mongoose = require('mongoose').set('debug', process.env.VITE_DEBUG);
|
||||
|
||||
// Configurazione globale di Mongoose
|
||||
mongoose.Promise = global.Promise;
|
||||
|
||||
mongoose.level = "";
|
||||
|
||||
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
mongoose.set('debug', false);
|
||||
mongoose.set('strictQuery', false);
|
||||
|
||||
// Opzioni di connessione
|
||||
let options = {
|
||||
// user: process.env.UDB,
|
||||
// pass: process.env.PDB,
|
||||
// useMongoClient: true,
|
||||
// useMongoClient: false,
|
||||
useNewUrlParser: true,
|
||||
// useFindAndModify: true,
|
||||
useFindAndModify: false,
|
||||
// useCreateIndex: true,
|
||||
useUnifiedTopology: true,
|
||||
|
||||
promiseLibrary: require('bluebird'),
|
||||
|
||||
// autoIndex: false, // Don't build indexes
|
||||
// reconnectTries: Number.MAX_VALUE, // Never stop trying to reconnect
|
||||
// reconnectInterval: 500, // Reconnect every 500ms
|
||||
// poolSize: 10, // Maintain up to 10 socket connections
|
||||
// // If not connected, return errors immediately rather than waiting for reconnect
|
||||
// bufferMaxEntries: 0,
|
||||
// connectTimeoutMS: 10000, // Give up initial connection after 10 seconds
|
||||
// socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity
|
||||
// family: 4 // Use IPv4, skip trying IPv6
|
||||
|
||||
// keepAlive: true, // keepAlive is true by default since mongoose 5.2.0
|
||||
// keepAliveInitialDelay: 300000 // keepAliveInitialDelay is the number of milliseconds to wait before initiating keepAlive on the socket.
|
||||
maxPoolSize: 5,
|
||||
// useNewUrlParser: true,
|
||||
// useUnifiedTopology: true,
|
||||
serverSelectionTimeoutMS: 20000, // Timeout di 30 secondi per la selezione del server
|
||||
};
|
||||
|
||||
// Controllo dell'autenticazione
|
||||
console.log('process.env.AUTH_MONGODB', process.env.AUTH_MONGODB);
|
||||
|
||||
const username = encodeURIComponent(process.env.MONGODB_USER);
|
||||
const password = encodeURIComponent(process.env.MONGODB_PWD);
|
||||
|
||||
|
||||
if (process.env.AUTH_MONGODB === '1') {
|
||||
options.auth = {
|
||||
authSource: "admin",
|
||||
poolSize: 10,
|
||||
user: process.env.MONGODB_USER,
|
||||
password: process.env.MONGODB_PWD,
|
||||
username,
|
||||
password
|
||||
};
|
||||
}
|
||||
|
||||
if (options.auth && options.auth.user) {
|
||||
console.log('MongoDb con Authenticazione:', options.auth.user, '******');
|
||||
if (options.auth && options.auth.username) {
|
||||
console.log('MongoDb con Authenticazione:', options.auth.username, '******');
|
||||
} else {
|
||||
console.log('### MongoDb SENZA Authenticazione !!! ');
|
||||
}
|
||||
|
||||
const db = mongoose.connection;
|
||||
|
||||
// Stampa delle informazioni di sistema
|
||||
console.log('Node Version ' + process.version);
|
||||
console.log('Mongoose Version ' + mongoose.version);
|
||||
|
||||
connectionUrl = process.env.MONGODB_URI;
|
||||
// URL di connessione
|
||||
const connectionUrl = process.env.MONGODB_URI;
|
||||
console.log('Connessione a ' + process.env.MONGODB_URI_NOPWD + ' in corso...');
|
||||
|
||||
console.log('Connessione a ' + connectionUrl + ' in corso...');
|
||||
mongoose.connect(connectionUrl, options);
|
||||
// Funzione per connettersi al database con retry
|
||||
async function connectToDatabase(uri, opts) {
|
||||
let isConnected = false;
|
||||
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function () {
|
||||
// we're connected!
|
||||
console.log('*** CONNESSIONE EFFETTUATA ! ' + connectionUrl + ' db: ' + process.env.DATABASE)
|
||||
while (!isConnected) {
|
||||
try {
|
||||
console.log("Sto provando a connettermi al database...");
|
||||
await mongoose.connect(uri);
|
||||
|
||||
});
|
||||
console.log(' *** CONNESSIONE EFFETTUATA ! ' + ' db: ' + process.env.DATABASE);
|
||||
|
||||
module.exports = { mongoose };
|
||||
console.log(' Database corrente:', mongoose.connection.name);
|
||||
|
||||
// Ottieni l'URL completo della connessione
|
||||
// console.log(' URL di connessione:', mongoose.connection.client.s.url);
|
||||
|
||||
const db = mongoose.connection;
|
||||
const serverInfo = await db.db.admin().serverStatus(); // Ottieni lo stato del server
|
||||
console.log(` Versione di MongoDB: ${serverInfo.version}`); // Stampa la versione
|
||||
|
||||
isConnected = true; // Imposta la flag di connessione a true
|
||||
} catch (error) {
|
||||
console.error(" Errore durante la connessione al database:", error.message);
|
||||
|
||||
// if (error.name === 'MongooseServerSelectionError' || error.name === 'MongoServerError') {
|
||||
console.log(" Ritento la connessione tra 1 minuto...");
|
||||
await new Promise((resolve) => setTimeout(resolve, 60000)); // Attendi 1 minuto prima di ritentare
|
||||
/*} else {
|
||||
console.error(" Errore irreversibile. Arresto il processo.");
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000)); // Attendi 1 minuto prima di ritentare
|
||||
process.exit(1); // Termina il processo in caso di errore irreversibile
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Esporta Mongoose
|
||||
module.exports = { mongoose, connectToDatabase, connectionUrl, options };
|
||||
@@ -35,8 +35,8 @@
|
||||
"CIRCUIT_REQUEST_TO_ENTER": "%s ha chiesto di entrare nel circuito %s",
|
||||
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
||||
"CIRCUIT_REQUEST": "Richiesta di entrare nel Circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "Sei stato aggiunto come Amministratore del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore/Amministratrice del circuito %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "Sei stato aggiunto come Amministratore/Amministratrice del circuito %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del circuito %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN_YOU": "Ti è stato rimosso l'incarico di Amministratore del circuito %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il Circuito %s da parte di %s",
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
"Good": "Bene",
|
||||
"Service": "Servizio",
|
||||
"Hosp": "Ospitalità",
|
||||
"Hosp %s": "Ospitalità: %s",
|
||||
"Event": "Evento",
|
||||
"Good: %s": "Bene: %s",
|
||||
"Service: %s": "Servizio: %s",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong>",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong>",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong>",
|
||||
"NEW_GOOD": "❇️ <strong>%s</strong> ha aggiunto un nuovo Bene: \n<strong>%s</strong> a %s",
|
||||
"NEW_SERVICE": "❇️ <strong>%s</strong> ha aggiunto un nuovo Servizio: \n<strong>%s</strong> a %s",
|
||||
"NEW_HOSP": "❇️ <strong>%s</strong> ha aggiunto una nuova Ospitalità: \n<strong>%s</strong> a %s",
|
||||
"NEW_EVENT": "❇️ <strong>%s</strong> ha aggiunto un nuovo Evento: \n%s\n<strong>%s</strong>\n%s",
|
||||
"NEW_EVENT_TELEGRAM": "%s\n\n❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
"NEW_ANNUNCIO_TELEGRAM": "❇️ <strong>%s</strong>\n\n%s\n\n%s",
|
||||
@@ -37,8 +39,8 @@
|
||||
"GROUP_REQUEST_TO_ENTER": "%s ha chiesto di entrare nel gruppo %s",
|
||||
"GROUP_CREATED": "✅ %s ha creato un nuovo Gruppo chiamato %s",
|
||||
"GROUP_REQUEST": "Richiesta di entrare nel Gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP": "E' stato aggiunto %s come Amministratore del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP_YOU": "Sei stato aggiunto come Amministratore del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP": "E' stato aggiunto %s come Amministratore/Amministratrice del gruppo %s da parte di %s",
|
||||
"GROUPS_ADDED_ADMIN_GROUP_YOU": "Sei stato aggiunto come Amministratore/Amministratrice del gruppo %s da parte di %s",
|
||||
"GROUPS_REMOVED_ADMIN_GROUP": "E' stato rimosso l'incarico di Amministratore a %s del gruppo %s da parte di %s",
|
||||
"GROUPS_REMOVED_ADMIN_GROUP_YOU": "Ti è stato rimosso l'incarico di Amministratore del gruppo %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_GRUPPO": "Richiesta di bloccare il Gruppo %s da parte di %s",
|
||||
@@ -51,16 +53,21 @@
|
||||
"FRIEND_UNBLOCKED_YOU": "Hai riattivato %s.",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY": "❇️👥 🧍♂️ Abilita Fiducia a %s nel '%s':",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP": "❇️👥 🧍♂️ Abilita Fiducia nel Circuito al gruppo %s:",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_CIRC": "❇️👥 🧍♂️ Fai entrare a %s nel '%s':",
|
||||
"CIRCUIT_ACCEPT_NEWENTRY_BYGROUP_CIRC": "❇️👥 🧍♂️ Fai entrare nel Circuito al gruppo %s:",
|
||||
"CIRCUIT_OPEN_RISITALIA": "Apri il Circuito RIS Italia e chiedi di entrare",
|
||||
"CIRCUIT_REQUEST_TO_ENTER": "%s è entrato nel %s (con %s iscritti) ed è in attesa di essere abilitato alla Fiducia\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_SHORT": "%s ha fatto richiesta di entrare nel %s (con %s iscritti)\n🙎🏻♂️ Invitato da %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_ASKMANAGER_TITLE": "++ Nuova Richiesta di %s",
|
||||
"CIRCUIT_ADMINS": "Gli amministratori del circuito sono %s:\n%s",
|
||||
"CIRCUIT_WHERE_IS_PRESENT": "\nAttualmente è presente in: %s",
|
||||
"CIRCUIT_REQUEST_TO_ENTER_WITH_GROUP": "il gruppo %s ha chiesto di entrare nel %s (con %s iscritti)",
|
||||
"CIRCUIT_CREATED": "✅ %s ha creato un nuovo Circuito chiamato %s",
|
||||
"CIRCUIT_REQUEST": "Richiesta di entrare nel %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "%s sei stato aggiunto come Amministratore del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore a %s del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN": "E' stato aggiunto %s come Amministratore/Amministratrice del %s da parte di %s",
|
||||
"CIRCUIT_ADDED_ADMIN_YOU": "%s sei stato aggiunto come Amministratore/Amministratrice del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN": "E' stato rimosso l'incarico di Amministratore/Amministratrice a %s del %s da parte di %s",
|
||||
"CIRCUIT_REMOVED_ADMIN_YOU": "%s ti è stato rimosso l'incarico di Amministratore del %s da parte di %s",
|
||||
"RICHIESTA_BLOCCO_CIRCUIT": "Richiesta di bloccare il %s da parte di %s",
|
||||
"CIRCUIT_ELIMINATO": "Il %s è stato eliminato da parte di %s",
|
||||
@@ -87,18 +94,18 @@
|
||||
"CIRCUIT_SENDCOINSREQ_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) sta inviando <strong>%s %s</strong> al conto %s '%s' sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_ME": "Stai inviando <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"CIRCUIT_SENDCOINSREQ_TO_GROUP": "Stai inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "Hai ricevuto <strong>%s %s</strong> dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "Hai ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "<strong>%s %s</strong> ricevuti da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_YOU": "🟢 Hai ricevuto <strong>%s %s</strong> dal Conto %s '%s' sul '%s' (%s) .",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_GROUP_TO_GROUP": "🟢 il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> dal conto %s '%s' sul '%s' (%s).",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_GROUP": "🟢 il conto %s '%s' (%s) ha ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_FROM_ME_TO_YOU": "🟢 Hai ricevuto <strong>%s %s</strong> da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED": "🟢 <strong>%s %s</strong> ricevuti da %s sul '%s'.",
|
||||
"SALDO_UPDATE": "[Saldo <strong>%s %s</strong> sul '%s']",
|
||||
"SALDO_UPDATE_WHO": "[Saldo %s <strong>%s %s</strong> sul '%s']",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_ACCEPTED_TO_ME": "🔄 Hai inviato <strong>%s %s</strong> a %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED": "%s %s rifiutati da %s sul '%s'.",
|
||||
"ID_CIRCUIT_COINS_REFUSED_TO_ME": "%s %s rifiutati da %s sul '%s'.",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "L'importo supera la quantità massima concessa per %s",
|
||||
"CIRCUIT_AMOUNT_EXCEED_QTAMAX": "L'importo supera la quantità massima che il destinatario (%s) può accumulare",
|
||||
"CIRCUIT_AMOUNT_EXCEED_FIDO": "⚠️ L'importo supera la quantità massima concessa per %s",
|
||||
"CIRCUIT_AMOUNT_EXCEED_QTAMAX": "⚠️ L'importo supera la quantità massima che il destinatario (%s) può accumulare",
|
||||
"CIRCUIT_COINS_ALREADY_PROCESSED": "La richiesta è stata già processata. Stato %s",
|
||||
"STATUS_SENT": "Inviato",
|
||||
"STATUS_REFUSED": "Rifiutato",
|
||||
@@ -114,10 +121,15 @@
|
||||
"DATE_2DAYS": "%s dalle %s fino a %s alle %s",
|
||||
"SENDMSG_ENTRA_IN_RISO_ITALIA": "Ciao %s!<br>%s che appartiene al <em>%s</em> vuole inviarti dei RIS. Per poterli ricevere dovete entrambi utilizzare il <strong>Circuito RIS Italia</strong>.",
|
||||
"CLICCA_QUI": "CLICCA QUI",
|
||||
"✅ %s è stato Abilitato correttamente (da %s)!": "✅ %s è stato Abilitato correttamente (da %s)!",
|
||||
"✅ Sei stato Abilitato correttamente da %s!": "✅ Sei stato Abilitato correttamente da %s!",
|
||||
"✅ %s è stato Ammesso correttamente (da %s)!": "✅ %s è stato Ammesso correttamente (da %s)!",
|
||||
"✅ Sei stato Ammesso correttamente da %s!": "✅ Sei stato Ammesso correttamente da %s!",
|
||||
"🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!": "🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!",
|
||||
"🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.",
|
||||
"🚫 %s ha rifiutato l'accesso alla App a %s !": "🚫 %s ha rifiutato l'accesso alla App a %s !",
|
||||
"✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !"
|
||||
}
|
||||
"✅ Hai Ammesso l'accesso alla App a %s !": "✅ Hai Ammesso l'accesso alla App a %s !",
|
||||
"EXCEED_FIDO": "⚠️ L'importo supera la Fiducia concessa per %s",
|
||||
"EXCEED_QTAMAX": "⚠️ Attenzione! %s sta tentando di inviarti %s RIS, ma il tuo conto ha raggiunto il limite massimo di accumulo sul %s. \nPer poter ricevere il pagamento, devi prima spendere alcuni RIS cercando quello che ti serve, in modo da liberare spazio nel tuo conto. 🙏🏻",
|
||||
"EXCEED_QTAMAX_MITTENTE": "⚠️ Attenzione! %s ha raggiunto la quota massima accumulabile in RIS, pertanto non puoi inviarglieli. Dovrebbe prima cercare di spendere i RIS cercando quello che gli serve, in modo da liberare spazio nel suo conto. 🙏🏻",
|
||||
"Good: %": "Good: %",
|
||||
"Service: %": "Service: %"
|
||||
}
|
||||
@@ -11,99 +11,58 @@ const auth_default = (req, res, next) => {
|
||||
|
||||
};
|
||||
|
||||
const authenticate = (req, res, next) => {
|
||||
const token = req.header('x-auth');
|
||||
//const refreshToken = req.header('x-refrtok');
|
||||
|
||||
// console.log('authenticate... ');
|
||||
|
||||
let noaut = false;
|
||||
|
||||
if (req.body.hasOwnProperty('noaut')) {
|
||||
noaut = req.body.noaut;
|
||||
}
|
||||
|
||||
if (noaut) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
const access = 'auth';
|
||||
|
||||
return User.findByToken(token, access, true).then((ris) => {
|
||||
|
||||
if (ris && ris.user && !!ris.user.deleted) {
|
||||
if (ris.user.deleted)
|
||||
ris.user = null;
|
||||
}
|
||||
|
||||
if (ris.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
return Promise.reject(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED);
|
||||
}
|
||||
|
||||
if (!ris.user) {
|
||||
return Promise.reject(server_constants.RIS_CODE_HTTP_INVALID_TOKEN);
|
||||
}
|
||||
|
||||
if (!!ris.user) {
|
||||
// Save last time online
|
||||
ris.user.lasttimeonline = new Date();
|
||||
ris.user.retry_pwd = 0
|
||||
ris.user.useragent = req.get('User-Agent');
|
||||
|
||||
return ris.user.save().then(() => {
|
||||
req.user = ris.user;
|
||||
req.token = token;
|
||||
// req.refreshToken = refreshToken;
|
||||
req.access = access;
|
||||
next(); // Esegui il codice successivo
|
||||
});
|
||||
}
|
||||
// tools.mylog('userid', user._id);
|
||||
|
||||
}).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);
|
||||
res.status(server_constants.RIS_CODE_HTTP_INVALID_TOKEN).send();
|
||||
});
|
||||
};
|
||||
|
||||
const authenticate_noerror = (req, res, next) => {
|
||||
const authenticateMiddleware = async (req, res, next, withUser = false, lean = false, noError = false) => {
|
||||
try {
|
||||
const token = req.header('x-auth');
|
||||
const refreshToken = req.header('x-refrtok');
|
||||
const logPrefix = noError ? (withUser ? (lean ? 'WITHUSERLEAN' : 'WITHUSER') : 'NOERROR') : 'AUTH';
|
||||
|
||||
const access = 'auth';
|
||||
|
||||
return User.findByToken(token, access, false).then((ris) => {
|
||||
if (ris.code !== server_constants.RIS_CODE_OK) {
|
||||
req.user = null;
|
||||
req.token = null;
|
||||
req.access = null;
|
||||
req.code = ris.code;
|
||||
} else {
|
||||
req.user = ris.user;
|
||||
req.token = token;
|
||||
req.refreshToken = refreshToken;
|
||||
req.access = access;
|
||||
req.code = ris.code;
|
||||
}
|
||||
// Vai avanti ad eseguire il codice, in ogni modo !
|
||||
next();
|
||||
}).catch((e) => {
|
||||
if (!token) {
|
||||
req.user = null;
|
||||
req.token = null;
|
||||
req.access = null;
|
||||
req.code = 0;
|
||||
|
||||
// Continua comunque !
|
||||
next();
|
||||
});
|
||||
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||
console.log(` ## ${logPrefix}_TOKEN INVALIDO ❌ ...`);
|
||||
return noError ? next() : res.status(req.code).send();
|
||||
}
|
||||
|
||||
const user = await User.findByToken(token, 'auth', false, withUser, lean);
|
||||
|
||||
if (user.code !== server_constants.RIS_CODE_OK) {
|
||||
req.user = null;
|
||||
req.token = null;
|
||||
req.code = user.code;
|
||||
} else {
|
||||
req.user = user.user;
|
||||
req.token = token;
|
||||
req.refreshToken = refreshToken;
|
||||
req.code = user.code;
|
||||
}
|
||||
|
||||
if (user.code === server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
console.log(` TOKEN SCADUTO ! `);
|
||||
if (noError) {
|
||||
return next()
|
||||
} else {
|
||||
return res.status(server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED).send();
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(` ## ${logPrefix} NEXT ! AVANTI...`);
|
||||
next();
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
console.error('Errore nel middleware di autenticazione:', e);
|
||||
req.user = null;
|
||||
req.token = null;
|
||||
req.code = server_constants.RIS_CODE_HTTP_INVALID_TOKEN;
|
||||
noError ? next() : res.status(req.code).send();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = { authenticate, authenticate_noerror, auth_default };
|
||||
const authenticate = (req, res, next) => authenticateMiddleware(req, res, next);
|
||||
const authenticate_withUser = (req, res, next) => authenticateMiddleware(req, res, next, true);
|
||||
const authenticate_withUserLean = (req, res, next) => authenticateMiddleware(req, res, next, true, true);
|
||||
const authenticate_noerror = (req, res, next) => authenticateMiddleware(req, res, next, false, false, true);
|
||||
const authenticate_noerror_WithUser = (req, res, next) => authenticateMiddleware(req, res, next, true, false, true);
|
||||
const authenticate_noerror_WithUserLean = (req, res, next) => authenticateMiddleware(req, res, next, true, true, true);
|
||||
|
||||
module.exports = { authenticate, authenticate_noerror, auth_default, authenticate_withUser, authenticate_noerror_WithUser, authenticate_noerror_WithUserLean };
|
||||
|
||||
128
src/server/models/JobsInProgress.js
Executable file
@@ -0,0 +1,128 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
|
||||
const JobsInProgressSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
nomeFunzioneDbOp: {
|
||||
type: String,
|
||||
},
|
||||
status: {
|
||||
type: Number,
|
||||
},
|
||||
terminatedWhy: {
|
||||
type: Number,
|
||||
},
|
||||
comment: {
|
||||
type: String,
|
||||
},
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
});
|
||||
|
||||
JobsInProgressSchema.statics.chechifExistJobWorking = async function (jobData, terminateiftoolong) {
|
||||
|
||||
// controlla se esiste un altro job, non ancora terminato !STATUS_JOB.FINISH
|
||||
// se esiste già allora ritorna false
|
||||
const existingJob = await this.findOne({ idapp: jobData.idapp, nomeFunzioneDbOp: jobData.nomeFunzioneDbOp, status: { $ne: shared_consts.STATUS_JOB.FINISH } });
|
||||
if (existingJob) {
|
||||
// se il Job trovato è passato troppo tempo (oltre 3 ore date_created), allora fai finta che abbia già terminato
|
||||
// (in questo caso, non ritorna false, ma ritorna il job trovato, per permettere di gestire il caso in cui si vuole forzare il job a terminare)
|
||||
if (Math.abs(Date.now() - existingJob.date_created.getTime()) > 180 * 60 * 1000) {
|
||||
if (terminateiftoolong) {
|
||||
existingJob.status = shared_consts.STATUS_JOB.FINISH;
|
||||
existingJob.terminatedWhy = shared_consts.TERMINATED_WHY.TOOLONGTIME;
|
||||
await existingJob.save();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true; // E' in FUNZIONE il JOB
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
JobsInProgressSchema.statics.addNewJob = async function (jobData) {
|
||||
if (!jobData || typeof jobData !== 'object') {
|
||||
console.error('ERRORE: ❌ jobData deve essere un oggetto valido');
|
||||
}
|
||||
|
||||
const esistegia = await this.chechifExistJobWorking(jobData, true);
|
||||
|
||||
if (esistegia) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const newJob = await this.create(jobData);
|
||||
return newJob;
|
||||
} catch (err) {
|
||||
console.error('Errore nell\'aggiungere un nuovo record: ', err);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
JobsInProgressSchema.methods.terminateJob = async function (witherror) {
|
||||
try {
|
||||
|
||||
this.status = shared_consts.STATUS_JOB.FINISH;
|
||||
this.terminatedWhy = witherror ? shared_consts.TERMINATED_WHY.END_WITHERROR : shared_consts.TERMINATED_WHY.END_NORMALLY;
|
||||
await this.save();
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error('Errore durante la terminazione del job: ', err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JobsInProgressSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'descr', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
JobsInProgressSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
JobsInProgressSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const JobsInProgress = this;
|
||||
|
||||
try {
|
||||
return await JobsInProgress.find({ idapp }).then((arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
console.error('Errore: ', err);
|
||||
}
|
||||
};
|
||||
|
||||
const JobsInProgress = mongoose.model('JobsInProgress', JobsInProgressSchema);
|
||||
|
||||
JobsInProgress.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { JobsInProgress };
|
||||
@@ -10,7 +10,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
@@ -24,7 +24,7 @@ const AccountSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -98,14 +98,12 @@ AccountSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const myfind = { idapp, deleted: false };
|
||||
|
||||
return await Account.find(myfind, (err, arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
return await Account.find(myfind).lean();
|
||||
};
|
||||
|
||||
AccountSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID().toString();
|
||||
this._id = new ObjectId().toString();
|
||||
}
|
||||
|
||||
next();
|
||||
@@ -235,11 +233,11 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
|
||||
myaccount.totTransato = 0;
|
||||
}
|
||||
myaccount.totTransato += Math.abs(amount);
|
||||
|
||||
|
||||
if (!myaccount.numtransactions)
|
||||
myaccount.numtransactions = 0;
|
||||
myaccount.numtransactions++;
|
||||
|
||||
|
||||
myaccount.date_updated = new Date();
|
||||
|
||||
myaccountupdate.saldo = myaccount.saldo;
|
||||
@@ -255,7 +253,9 @@ AccountSchema.statics.addtoSaldo = async function (myaccount, amount, mitt) {
|
||||
// Calcola Saldo Pendente !
|
||||
await myaccount.calcPending(true);
|
||||
|
||||
return ris;
|
||||
const recupdated = await Account.findOne({ _id: myaccount.id });
|
||||
|
||||
return recupdated;
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -304,7 +304,7 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
|
||||
if (!myaccount && createifnotexist) {
|
||||
myaccount = new Account({
|
||||
_id: new ObjectID().toString(),
|
||||
_id: new ObjectId().toString(),
|
||||
idapp,
|
||||
username: (!groupname && !contocom) ? username : '',
|
||||
groupname,
|
||||
@@ -322,8 +322,9 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
});
|
||||
|
||||
if (contocom) {
|
||||
myaccount.fidoConcesso = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
|
||||
myaccount.qta_maxConcessa = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
|
||||
myaccount.fidoConcesso = mycircuit.fido_scoperto_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_CONTO_COMUNITARIO;
|
||||
myaccount.qta_maxConcessa = mycircuit.qta_max_default_contocom || shared_consts.CIRCUIT_PARAMS.SCOPERTO_MAX_CONTO_COMUNITARIO;
|
||||
|
||||
} else {
|
||||
if (!mycircuit.fido_scoperto_default_grp)
|
||||
mycircuit.fido_scoperto_default_grp = shared_consts.CIRCUIT_PARAMS.SCOPERTO_MIN_GRP;
|
||||
@@ -343,7 +344,13 @@ AccountSchema.statics.getAccountByUsernameAndCircuitId = async function (idapp,
|
||||
myaccount.fidoConcesso = 0;
|
||||
}
|
||||
|
||||
return await myaccount.save();
|
||||
let acc = await myaccount.save();
|
||||
|
||||
if (mycircuit.creditodiPartenza && mycircuit.creditodiPartenza > 0) {
|
||||
acc = await Account.addtoSaldo(acc, mycircuit.creditodiPartenza, false);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
return myaccount;
|
||||
@@ -605,8 +612,12 @@ AccountSchema.statics.SetMinMaxPersonali = async function (idapp, fidoConcesso,
|
||||
}
|
||||
});
|
||||
|
||||
// Se aggiorno questi dati, allora devo aggiornare anche gli account del RIS Nazionale
|
||||
await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
|
||||
const circuit = await Circuit.findOne({ _id: circuitId });
|
||||
|
||||
if (!circuit.circuitoIndipendente) {
|
||||
// Se aggiorno questi dati, e non è un Circuito Indipendente, allora devo aggiornare anche gli account del RIS Nazionale
|
||||
await Account.updateAccountCircuitoNazionaleByLimiti(idapp, circuitId, fidoConcesso, qta_maxConcessa);
|
||||
}
|
||||
|
||||
} else {
|
||||
const ris = await Account.updateMany({ idapp, fidoConcesso: { $gt: 0 }, username: { "$nin": [null, ""] } },
|
||||
@@ -646,7 +657,7 @@ AccountSchema.statics.updateQtaMax = async function (idapp, username, groupname,
|
||||
else
|
||||
risult = await Account.updateOne({ idapp, username, circuitId }, { $set: paramstoupdate });
|
||||
|
||||
return risult && risult.nModified > 0;
|
||||
return risult && risult.modifiedCount > 0;
|
||||
};
|
||||
|
||||
AccountSchema.statics.getAccountsCircuitiNazionali = async function (idapp) {
|
||||
@@ -690,9 +701,9 @@ AccountSchema.statics.updateAccountCircuitoNazionaleByLimiti = async function (i
|
||||
} catch (e) {
|
||||
console.error('updateAccountCircuitoNazionaleByLimiti', e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
};
|
||||
|
||||
AccountSchema.statics.canEditAccountAdmins = async function (username, id) {
|
||||
@@ -736,7 +747,7 @@ AccountSchema.statics.removeAdminOfAccount = async function (idapp, username, ci
|
||||
// Rimuovi l'account
|
||||
AccountSchema.statics.removeAccount = async function (accountId) {
|
||||
|
||||
return await Account.deleteOne({ _id: accountId});
|
||||
return await Account.deleteOne({ _id: accountId });
|
||||
};
|
||||
|
||||
AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp) {
|
||||
@@ -751,8 +762,8 @@ AccountSchema.statics.updateSaldoAndTransato_AllAccounts = async function (idapp
|
||||
|
||||
const Account = mongoose.model('Account', AccountSchema);
|
||||
|
||||
Account.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Account.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
module.exports = { Account };
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -42,13 +42,7 @@ AdTypeSchema.pre('save', async function (next) {
|
||||
AdTypeSchema.statics.findAllIdApp = async function(idapp) {
|
||||
const AdType = this;
|
||||
|
||||
const query = [
|
||||
{$sort: {_id: 1}},
|
||||
];
|
||||
|
||||
return await AdType.aggregate(query).then((arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
return AdType.find({}).sort({_id: 1}).lean();
|
||||
|
||||
};
|
||||
|
||||
@@ -64,8 +58,9 @@ AdTypeSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
|
||||
const AdType = mongoose.model('AdType', AdTypeSchema);
|
||||
|
||||
AdType.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
AdType.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = {AdType};
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {ObjectID} = require('mongodb');
|
||||
const {ObjectId} = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -64,8 +64,9 @@ AdTypeGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
|
||||
const AdTypeGood = mongoose.model('AdTypeGood', AdTypeGoodSchema);
|
||||
|
||||
AdTypeGood.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
AdTypeGood.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = {AdTypeGood};
|
||||
|
||||
@@ -11,7 +11,9 @@ const { MyGroup } = require('./mygroup');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const tableModel = shared_consts.TABLES_ATTIVITAS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -24,7 +26,7 @@ const AttivitaSchema = new Schema(
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -129,10 +131,9 @@ const AttivitaSchema = new Schema(
|
||||
//**ADDFIELD_ATTIVITA
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...MyGroup.getFieldsForAnnunci()
|
||||
...tools.getFieldsForAnnunci()
|
||||
}, { strict: false });
|
||||
|
||||
AttivitaSchema.index({ 'idapp': 1 });
|
||||
|
||||
|
||||
AttivitaSchema.pre('save', async function (next) {
|
||||
@@ -182,7 +183,7 @@ AttivitaSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
lk_FF: '_id',
|
||||
lk_as: 'user',
|
||||
af_objId_tab: 'myId',
|
||||
lk_proj: this.getProject(),
|
||||
lk_proj: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -236,7 +237,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -262,7 +263,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -288,7 +289,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
@@ -306,7 +307,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: this.getProject(),
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
@@ -339,7 +340,7 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
query = [...query, ...objadd.query];
|
||||
|
||||
const toadd = {
|
||||
$project: this.getProject(objadd.proj),
|
||||
$project: shared_consts.getProjectForAll(objadd.proj, tableModel),
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
@@ -388,8 +389,9 @@ AttivitaSchema.statics.getCompleteRecord = function (idapp, id) {
|
||||
|
||||
const Attivita = mongoose.model('Attivita', AttivitaSchema);
|
||||
|
||||
Attivita.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Attivita.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Attivita };
|
||||
|
||||
@@ -49,6 +49,7 @@ module.exports.findAllIdApp = async function (idapp) {
|
||||
return await Author.find(myfind).sort({name: 1, surname: 1});
|
||||
};
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
module.exports.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -68,10 +68,7 @@ bookingSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp, sall) {
|
||||
else
|
||||
myfind = { userId, idapp, booked: true };
|
||||
|
||||
return Booking.find(myfind, (err, arrbooked) => {
|
||||
// console.log('ris Booking:', arrbooked);
|
||||
return arrbooked
|
||||
});
|
||||
return Booking.find(myfind).lean();
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +91,7 @@ function getUsersByBooking(idapp) {
|
||||
$Lookup: {
|
||||
from: "users",
|
||||
localField: "userId", // field in my collection
|
||||
foreignField: "ObjectId(_id)", // field in the 'from' collection
|
||||
foreignField: "new ObjectId(_id)", // field in the 'from' collection
|
||||
as: "fromItems"
|
||||
}
|
||||
},
|
||||
@@ -122,8 +119,9 @@ bookingSchema.statics.findAllDistinctByBooking = function (idapp) {
|
||||
|
||||
const Booking = mongoose.model('Booking', bookingSchema);
|
||||
|
||||
Booking.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Booking.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Booking };
|
||||
|
||||
@@ -205,8 +205,9 @@ BotSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const MyBot = mongoose.model('Bot', BotSchema);
|
||||
|
||||
MyBot.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
MyBot.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { MyBot };
|
||||
|
||||
@@ -76,8 +76,9 @@ CalZoomSchema.statics.getNextZoom = async function (idapp) {
|
||||
|
||||
const CalZoom = mongoose.model('CalZoom', CalZoomSchema);
|
||||
|
||||
CalZoom.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CalZoom.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { CalZoom };
|
||||
|
||||
@@ -55,7 +55,7 @@ module.exports.getCartByUserId = async function (uid, idapp) {
|
||||
|
||||
if (!!mycart) {
|
||||
for (const idkey in mycart.items) {
|
||||
try {
|
||||
try {
|
||||
let idorder = mycart.items[idkey]._id.toString();
|
||||
let myorder = mycart.items[idkey].order;
|
||||
if (!!myorder) {
|
||||
@@ -89,15 +89,17 @@ module.exports.getCartByUserId = async function (uid, idapp) {
|
||||
|
||||
};
|
||||
|
||||
module.exports.updateCartByUserId = function (userId, newCart, callback) {
|
||||
let query = { userId: userId };
|
||||
Cart.find(query, function (err, c) {
|
||||
if (err) throw err;
|
||||
module.exports.updateCartByUserId = async function (userId, newCart) {
|
||||
const query = { userId: userId };
|
||||
|
||||
//exist cart in databse
|
||||
if (c.length > 0) {
|
||||
Cart.findOneAndUpdate(
|
||||
{ userId: userId },
|
||||
try {
|
||||
// Cerca il carrello esistente nel database
|
||||
const existingCart = await Cart.findOne(query);
|
||||
|
||||
if (existingCart) {
|
||||
// Se il carrello esiste, aggiorna i dati
|
||||
const updatedCart = await Cart.findOneAndUpdate(
|
||||
query,
|
||||
{
|
||||
$set: {
|
||||
items: newCart.items,
|
||||
@@ -107,14 +109,21 @@ module.exports.updateCartByUserId = function (userId, newCart, callback) {
|
||||
userId: userId,
|
||||
},
|
||||
},
|
||||
{ new: true },
|
||||
callback,
|
||||
{ new: true } // Restituisce il documento aggiornato
|
||||
);
|
||||
|
||||
return updatedCart; // Restituisce il carrello aggiornato
|
||||
} else {
|
||||
//no cart in database
|
||||
newCart.save(callback);
|
||||
// Se il carrello non esiste, crea un nuovo documento
|
||||
const createdCart = new Cart(newCart);
|
||||
const savedCart = await createdCart.save();
|
||||
return savedCart; // Restituisce il carrello creato
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
// Gestione degli errori
|
||||
console.error("Errore durante l'aggiornamento del carrello:", err);
|
||||
throw err; // Propaga l'errore al chiamante
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.updateCartByCartId = async function (cartId, newCart) {
|
||||
@@ -148,7 +157,7 @@ module.exports.updateCartByCartId = async function (cartId, newCart) {
|
||||
};
|
||||
|
||||
module.exports.deleteCartByCartId = async function (cartId) {
|
||||
return await Cart.remove({ _id: cartId });
|
||||
return await Cart.deleteOne({ _id: cartId });
|
||||
};
|
||||
|
||||
module.exports.createCart = async function (newCart) {
|
||||
@@ -156,6 +165,7 @@ module.exports.createCart = async function (newCart) {
|
||||
};
|
||||
|
||||
|
||||
Cart.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Cart.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -28,9 +28,10 @@ const CashCategorySchema = new Schema({
|
||||
|
||||
var CashCategory = module.exports = mongoose.model('CashCategory', CashCategorySchema);
|
||||
|
||||
CashCategory.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CashCategory.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return []
|
||||
@@ -44,7 +45,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await CashCategory.find(myfind);
|
||||
return await CashCategory.find(myfind).lean();
|
||||
};
|
||||
|
||||
module.exports.getAllCashCategory = function (query, sort, callback) {
|
||||
|
||||
@@ -3,7 +3,7 @@ const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
@@ -43,7 +43,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await CashSubCategory.find(myfind);
|
||||
return await CashSubCategory.find(myfind).lean();
|
||||
};
|
||||
|
||||
module.exports.getAllCashSubCategory = function (query, sort, callback) {
|
||||
@@ -70,6 +70,7 @@ module.exports.createCashSubCategory = async function (CashSubCategory) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
module.exports.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ mongoose.plugin(schema => {
|
||||
});
|
||||
|
||||
const CatAISchema = new Schema({
|
||||
_id: {
|
||||
type: Number,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
},
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
},
|
||||
@@ -47,15 +47,16 @@ CatAISchema.statics.executeQueryTable = function (idapp, params) {
|
||||
};
|
||||
|
||||
CatAISchema.statics.findAllIdApp = async function (idapp) {
|
||||
const myfind = {};
|
||||
const myfind = { idapp };
|
||||
|
||||
return await CatAI.find(myfind).sort({ name: 1 });
|
||||
return await CatAI.find(myfind).sort({ name: 1 }).lean();
|
||||
};
|
||||
|
||||
const CatAI = mongoose.model('CatAI', CatAISchema);
|
||||
|
||||
CatAI.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CatAI.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = CatAI;
|
||||
|
||||
257
src/server/models/catalog.js
Executable file
@@ -0,0 +1,257 @@
|
||||
const mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const { IImg } = require('../models/myscheda');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
|
||||
const CatalogSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
index: true,
|
||||
},
|
||||
foto_collana: IImg,
|
||||
|
||||
idCollane: [{
|
||||
type: String,
|
||||
}],
|
||||
idTipoFormato: [{
|
||||
type: Number,
|
||||
}],
|
||||
|
||||
argomenti: [{
|
||||
type: String,
|
||||
}],
|
||||
condition_andor: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
|
||||
editore: [{ type: String }],
|
||||
|
||||
descr_introduttiva: {
|
||||
type: String,
|
||||
},
|
||||
idPageAssigned: {
|
||||
type: String,
|
||||
},
|
||||
idPageAssigned_stampa: {
|
||||
type: String,
|
||||
},
|
||||
referenti: [{
|
||||
type: String,
|
||||
}],
|
||||
|
||||
img_bordata: IImg,
|
||||
img_intro: IImg,
|
||||
img_bordata_stampa: IImg,
|
||||
img_intro_stampa: IImg,
|
||||
pagina_introduttiva_sfondo_nero: {
|
||||
type: Boolean,
|
||||
},
|
||||
|
||||
pdf_generato: String,
|
||||
pdf_generato_stampa: String,
|
||||
data_generato: {
|
||||
type: Date,
|
||||
},
|
||||
data_generato_stampa: {
|
||||
type: Date,
|
||||
},
|
||||
username_lista_generata: {
|
||||
type: String,
|
||||
},
|
||||
data_lista_generata: {
|
||||
type: Date,
|
||||
},
|
||||
pdf_online: String,
|
||||
data_online: {
|
||||
type: Date,
|
||||
},
|
||||
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
lista_prodotti: [{
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Product',
|
||||
}],
|
||||
isCatalogoGenerale: Boolean,
|
||||
});
|
||||
|
||||
/*
|
||||
TOLTO ALTRIMENTI su /settable non mi crea l'ID
|
||||
CatalogSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectId();
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
*/
|
||||
|
||||
CatalogSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'title', type: tools.FieldType.string }]
|
||||
};
|
||||
|
||||
CatalogSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
/*CatalogSchema.statics.OLD_findAllIdApp = async function (idapp) {
|
||||
const Catalog = this;
|
||||
|
||||
const arrrec = await Catalog.aggregate([
|
||||
// Filtra i documenti per idapp
|
||||
{ $match: { idapp } },
|
||||
|
||||
// Ordina i risultati per titolo
|
||||
{ $sort: { title: 1 } },
|
||||
|
||||
// Esegui il join con la collezione Collana
|
||||
{
|
||||
$lookup: {
|
||||
from: "collanas", // Nome della collezione Collana
|
||||
localField: "idCollane", // Campo in Catalog
|
||||
foreignField: "idCollana", // Campo in Collana
|
||||
as: "collana_info" // Nome del campo che conterrà i risultati del join
|
||||
}
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
return arrrec;
|
||||
};*/
|
||||
|
||||
CatalogSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Catalog = this;
|
||||
|
||||
try {
|
||||
let arrrec = await Catalog.find({ idapp })
|
||||
.sort({ title: 1 }) // Ordina i risultati per titolo
|
||||
/*.populate({
|
||||
path: "idCollane", // Popola il campo idCollane
|
||||
model: "Collana" // Specifica il modello della collezione Collana
|
||||
})*/
|
||||
.populate({
|
||||
path: "lista_prodotti", // Popola il campo lista_prodotti
|
||||
populate: {
|
||||
path: "idProductInfo",
|
||||
model: "ProductInfo",
|
||||
populate: [
|
||||
{
|
||||
path: "idCatProds",
|
||||
model: "CatProd"
|
||||
},
|
||||
{
|
||||
path: "idSubCatProds",
|
||||
model: "SubCatProd"
|
||||
},
|
||||
{
|
||||
path: "idAuthors",
|
||||
model: "Author"
|
||||
}
|
||||
],
|
||||
},
|
||||
})
|
||||
.populate({
|
||||
path: "lista_prodotti",
|
||||
populate: {
|
||||
path: "idProducer",
|
||||
model: "Producer"
|
||||
}
|
||||
})
|
||||
.populate({
|
||||
path: "lista_prodotti",
|
||||
populate: {
|
||||
path: "idProvider",
|
||||
model: "Provider"
|
||||
}
|
||||
})
|
||||
.populate({
|
||||
path: "lista_prodotti",
|
||||
populate: {
|
||||
path: "idStorehouses",
|
||||
model: "Storehouse"
|
||||
}
|
||||
})
|
||||
.populate({
|
||||
path: "lista_prodotti",
|
||||
populate: {
|
||||
path: "idScontisticas",
|
||||
model: "Scontistica"
|
||||
}
|
||||
})
|
||||
.populate({
|
||||
path: "lista_prodotti",
|
||||
populate: {
|
||||
path: "idGasordine",
|
||||
model: "Gasordine"
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
// controlla prima se nella lista ci sono dei product che non esistono piu allora li devi rimuovere !
|
||||
for (const catalog of arrrec) {
|
||||
const originalLength = catalog.lista_prodotti.length;
|
||||
catalog.lista_prodotti = catalog.lista_prodotti.filter(product => product.idProductInfo);
|
||||
if (catalog.lista_prodotti.length !== originalLength) {
|
||||
await catalog.save();
|
||||
}
|
||||
}
|
||||
|
||||
const transformedArrRec = arrrec.map(catalog => ({
|
||||
...catalog.toObject(), // Converte il documento Mongoose in un oggetto JavaScript puro
|
||||
lista_prodotti: catalog.lista_prodotti.map(product => ({
|
||||
...product.toObject(),
|
||||
productInfo: {
|
||||
...product.idProductInfo.toObject(), // Copia tutti i campi di idProductInfo
|
||||
catprods: product.idProductInfo.idCatProds, // Rinomina idCatProds in catprods
|
||||
subcatprods: product.idProductInfo.idSubCatProds,
|
||||
collana: product.idProductInfo.idCollana,
|
||||
authors: product.idProductInfo.idAuthors,
|
||||
},
|
||||
producer: product.idProducer,
|
||||
storehouse: product.idStorehouses,
|
||||
scontisticas: product.idScontisticas,
|
||||
gasordine: product.idGasordine,
|
||||
})),
|
||||
}));
|
||||
|
||||
return transformedArrRec;
|
||||
} catch (err) {
|
||||
console.error('Errore: ', err);
|
||||
}
|
||||
};
|
||||
|
||||
const Catalog = mongoose.model('Catalog', CatalogSchema);
|
||||
|
||||
Catalog.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Catalog };
|
||||
@@ -45,14 +45,15 @@ CategorySchema.statics.executeQueryTable = function (idapp, params) {
|
||||
CategorySchema.statics.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Category.find(myfind);
|
||||
return await Category.find(myfind).lean();
|
||||
};
|
||||
|
||||
const Category = mongoose.model('Category', CategorySchema);
|
||||
|
||||
Category.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Category.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
|
||||
module.exports = { Category };
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -80,8 +80,9 @@ CatGrpSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
|
||||
const CatGrp = mongoose.model('CatGrp', CatGrpSchema);
|
||||
|
||||
CatGrp.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CatGrp.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { CatGrp };
|
||||
|
||||
@@ -16,8 +16,15 @@ const CatProdSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
idArgomento: {
|
||||
type: Number,
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
index: 1,
|
||||
},
|
||||
descr_estesa: {
|
||||
type: String,
|
||||
},
|
||||
img: {
|
||||
type: String,
|
||||
@@ -28,6 +35,9 @@ const CatProdSchema = new Schema({
|
||||
color: {
|
||||
type: String,
|
||||
},
|
||||
quanti: {
|
||||
type: Number,
|
||||
}
|
||||
});
|
||||
|
||||
CatProdSchema.statics.getAllCategories = function (callback) {
|
||||
@@ -49,14 +59,122 @@ CatProdSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
CatProdSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await CatProd.find(myfind).sort({ name: 1 });
|
||||
return await CatProd.find(myfind).sort({ name: 1 }).lean();
|
||||
};
|
||||
|
||||
CatProdSchema.statics.updateCatDeleteEmpty = async function (idapp) {
|
||||
try {
|
||||
const toDelete = await CatProd.aggregate([
|
||||
{ $match: { idapp } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'productinfos',
|
||||
localField: '_id',
|
||||
foreignField: 'idCatProds',
|
||||
as: 'products'
|
||||
}
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
_id: 1,
|
||||
name: 1,
|
||||
quanti: { $size: '$products' } // Conta il numero di prodotti per ciascun CatProd
|
||||
}
|
||||
},
|
||||
{ $match: { quanti: 0 } },
|
||||
]);
|
||||
|
||||
if (toDelete.length > 0) {
|
||||
const ids = toDelete.map(x => x._id);
|
||||
const ris = await CatProd.deleteMany({ _id: { $in: ids } });
|
||||
const deletedRecs = toDelete.map(x => ({ _id: x._id, name: x.name }));
|
||||
if (deletedRecs.length > 0) {
|
||||
return `Lista Argomenti cancellati: ${deletedRecs.map(x => x.name).join(', ')}`;
|
||||
}
|
||||
}
|
||||
return "Nessun argomento cancellato";
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error UpdateCatDeleteEmpty:', error);
|
||||
return error;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp, updatedata) {
|
||||
try {
|
||||
|
||||
const myquery = [
|
||||
{ $match: { idapp } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'productinfos', // Nome della tua collezione productInfo
|
||||
localField: '_id',
|
||||
foreignField: 'idCatProds',
|
||||
as: 'products'
|
||||
}
|
||||
},
|
||||
{
|
||||
$addFields: {
|
||||
myproducts: {
|
||||
$filter: {
|
||||
input: "$products",
|
||||
as: "prod",
|
||||
cond: {
|
||||
$in: ["$$prod.idStatoProdotto", [1, 4, 34, 45, 46]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
$project: {
|
||||
_id: 1,
|
||||
name: 1,
|
||||
idArgomento: 1,
|
||||
descr_estesa: 1,
|
||||
img: 1,
|
||||
icon: 1,
|
||||
color: 1,
|
||||
quanti: { $size: '$myproducts' }, // Conta il numero di prodotti per ciascun CatProd
|
||||
products: {
|
||||
$map: {
|
||||
input: "$myproducts",
|
||||
as: "prod",
|
||||
in: {
|
||||
name: "$$prod.name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ $sort: { name: 1 } } // Ordina i risultati per nome
|
||||
];
|
||||
|
||||
const result = await CatProd.aggregate(myquery);
|
||||
|
||||
if (updatedata) {
|
||||
for (const record of result) {
|
||||
await CatProd.updateOne(
|
||||
{ _id: record._id },
|
||||
{ $set: { quanti: record.quanti } }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error retrieving CatProd with title count:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const CatProd = mongoose.model('CatProd', CatProdSchema);
|
||||
|
||||
CatProd.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CatProd.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
|
||||
module.exports = CatProd;
|
||||
|
||||
@@ -5,7 +5,7 @@ mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -43,9 +43,10 @@ CfgServerSchema.statics.findAllIdApp = async function(idapp) {
|
||||
|
||||
const CfgServer = mongoose.model('CfgServer', CfgServerSchema);
|
||||
|
||||
CfgServer.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
CfgServer.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = {CfgServer};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const { Movement } = require('../models/movement');
|
||||
const { Account } = require('../models/account');
|
||||
@@ -26,7 +26,7 @@ const CircuitSchema = new Schema({
|
||||
_id: {
|
||||
type: String,
|
||||
default: function () {
|
||||
return new ObjectID().toString();
|
||||
return new ObjectId().toString();
|
||||
},
|
||||
},
|
||||
idapp: {
|
||||
@@ -127,6 +127,12 @@ const CircuitSchema = new Schema({
|
||||
qta_max_default_grp: {
|
||||
type: Number,
|
||||
},
|
||||
fido_scoperto_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
qta_max_default_contocom: {
|
||||
type: Number,
|
||||
},
|
||||
data_costituz: {
|
||||
type: Date,
|
||||
},
|
||||
@@ -229,11 +235,27 @@ const CircuitSchema = new Schema({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
askManagerToEnter: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
sendEmailAfterAskingToEnter: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
circuitoIndipendente: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
creditodiPartenza: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
CircuitSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
this._id = new ObjectID().toString();
|
||||
this._id = new ObjectId().toString();
|
||||
|
||||
this.date_created = new Date();
|
||||
}
|
||||
@@ -248,7 +270,7 @@ CircuitSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const whatToShow = this.getWhatToShow(idapp, '');
|
||||
|
||||
return await Circuit.find(myfind, whatToShow).sort({ status: -1, numMembers: -1, name: 1 });
|
||||
return await Circuit.find(myfind, whatToShow).sort({ name: 1 }).lean();
|
||||
};
|
||||
|
||||
CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||
@@ -257,7 +279,7 @@ CircuitSchema.statics.isCircuitAdmin = async function (idrec, username) {
|
||||
|
||||
const mycirc = await Circuit.findOne({ _id: idrec }).lean();
|
||||
if (mycirc) {
|
||||
return mycirc.admins.some(admin => admin.username === username);
|
||||
return mycirc.admins.some(admin => (admin.username === username) || (admin.username === shared_consts.USER_ADMIN_CIRCUITS));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -300,8 +322,15 @@ CircuitSchema.statics.getWhatToShow = function (idapp, username) {
|
||||
qta_max_default: 1,
|
||||
fido_scoperto_default_grp: 1,
|
||||
qta_max_default_grp: 1,
|
||||
fido_scoperto_default_contocom: 1,
|
||||
qta_max_default_contocom: 1,
|
||||
deperimento: 1,
|
||||
showAlways: 1,
|
||||
ignoreLimits: 1,
|
||||
askManagerToEnter: 1,
|
||||
sendEmailAfterAskingToEnter: 1,
|
||||
circuitoIndipendente: 1,
|
||||
creditodiPartenza: 1,
|
||||
transactionsEnabled: 1,
|
||||
status: 1,
|
||||
valuta_per_euro: 1,
|
||||
@@ -359,6 +388,11 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
regulation: 1,
|
||||
numMembers: 1,
|
||||
showAlways: 1,
|
||||
ignoreLimits: 1,
|
||||
askManagerToEnter: 1,
|
||||
sendEmailAfterAskingToEnter: 1,
|
||||
circuitoIndipendente: 1,
|
||||
creditodiPartenza: 1,
|
||||
systemUserId: 1,
|
||||
founderUserId: 1,
|
||||
nome_valuta: 1,
|
||||
@@ -367,6 +401,8 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
fido_scoperto_default: 1,
|
||||
fido_scoperto_default_grp: 1,
|
||||
qta_max_default_grp: 1,
|
||||
fido_scoperto_default_contocom: 1,
|
||||
qta_max_default_contocom: 1,
|
||||
qta_max_default: 1,
|
||||
valuta_per_euro: 1,
|
||||
symbol: 1,
|
||||
@@ -394,7 +430,7 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
|
||||
};
|
||||
};
|
||||
|
||||
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user) {
|
||||
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user, nummovTodownload) {
|
||||
|
||||
try {
|
||||
const { User } = require('../models/user');
|
||||
@@ -420,7 +456,7 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
|
||||
$or: [
|
||||
{ deleted: { $exists: false } },
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).sort({ status: -1, numMembers: -1, name: 1 }).lean();
|
||||
}, whatToShow_Unknown).sort({ name: 1 }).lean();
|
||||
|
||||
let asked_circuits = await Circuit.find({
|
||||
idapp,
|
||||
@@ -442,12 +478,15 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, whatToShow_Unknown).sort({ status: -1 }).lean();
|
||||
|
||||
const last_my_transactions = await Movement.getLastN_Transactions(idapp, nummovTodownload, username, '');
|
||||
|
||||
return {
|
||||
listcircuits,
|
||||
asked_circuits,
|
||||
refused_circuits,
|
||||
manage_mycircuits,
|
||||
mycircuits: user.profile.mycircuits,
|
||||
last_my_transactions,
|
||||
};
|
||||
|
||||
} catch (e) {
|
||||
@@ -484,6 +523,16 @@ CircuitSchema.statics.getInfoCircuitByName = async function (idapp, name) {
|
||||
|
||||
CircuitSchema.statics.getCircuitByName = async function (idapp, name) {
|
||||
|
||||
if (name === 'Circuito RIS Benevento') {
|
||||
name = 'Circuito RIS Campania';
|
||||
} else if (name === 'RIS Pesaro e Urbino') {
|
||||
name = 'Circuito RIS Pesaro e Urbino';
|
||||
} else if (name === 'RIS Catania') {
|
||||
name = 'Circuito RIS Catania';
|
||||
} else if (name === 'RIS Palermo') {
|
||||
name = 'Circuito RIS Palermo';
|
||||
}
|
||||
|
||||
const myfind = {
|
||||
idapp,
|
||||
name,
|
||||
@@ -558,7 +607,7 @@ CircuitSchema.statics.getCircuitById = async function (circuitId) {
|
||||
|
||||
CircuitSchema.statics.deleteCircuit = async function (idapp, usernameOrig, name) {
|
||||
console.log('Circuito ' + name + ' rimosso da ' + usernameOrig);
|
||||
return await Circuit.findOneAndRemove({ idapp, name });
|
||||
return await Circuit.findOneAndDelete({ idapp, name });
|
||||
};
|
||||
|
||||
|
||||
@@ -664,11 +713,14 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const { MyGroup } = require('./mygroup');
|
||||
|
||||
const sendemail = require('../sendemail');
|
||||
|
||||
let ris = {
|
||||
result: false,
|
||||
cansend: true,
|
||||
errorcode: 0,
|
||||
errormsg: '',
|
||||
rec: null,
|
||||
useraccounts: [],
|
||||
@@ -717,18 +769,20 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
if (accountorigTable.saldo - myqty < -accountorigTable.fidoConcesso) {
|
||||
ris.cansend = false;
|
||||
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_FIDO', usernameOrig);
|
||||
ris.errorcode = shared_consts.SENDRIS_CODES.EXCEED_FIDO;
|
||||
}
|
||||
|
||||
if (accountdestTable.saldo + myqty > accountdestTable.qta_maxConcessa) {
|
||||
ris.cansend = false;
|
||||
ris.errormsg = i18n.__('CIRCUIT_AMOUNT_EXCEED_QTAMAX', extrarec.dest);
|
||||
ris.errorcode = shared_consts.SENDRIS_CODES.EXCEED_QTAMAX;
|
||||
}
|
||||
}
|
||||
|
||||
if (!onlycheck) {
|
||||
// Add a Transaction !
|
||||
if (ris.cansend) {
|
||||
ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.notifId, extrarec.idOrdersCart);
|
||||
ris.rec = await Movement.addMov(idapp, accountorigTable, accountdestTable, myqty, extrarec.causal, extrarec.causalDest, extrarec.notifId, extrarec.idOrdersCart);
|
||||
}
|
||||
|
||||
if (ris.cansend && ris.rec) {
|
||||
@@ -759,8 +813,9 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
let dest = (extrarec.dest ? extrarec.dest : '') + (extrarec.groupdest ? extrarec.groupdest : '') + (extrarec.contoComDest ? extrarec.contoComDest : '');
|
||||
|
||||
ris.result = true;
|
||||
let causalDest = extrarec.causalDest ? 'Causale Destinatario: ' + extrarec.causalDest : ''
|
||||
let msg = '[<b>' + circuittable.name + '</b>]: Inviate Monete da ' + orig + ' a ' + dest + ' ' + myqty + ' ' + circuittable.symbol + ' [causale: ' + extrarec.causal +
|
||||
`]\nSaldi:\n${orig}: ` + extrarec.saldoOrig + ' ' + circuittable.symbol + '] ' + `\n${dest}: ` + extrarec.saldoDest + ' ' + circuittable.symbol + ']';
|
||||
`]\n` + causalDest+ `\nSaldi:\n${orig}: ` + extrarec.saldoOrig + ' ' + circuittable.symbol + '] ' + `\n${dest}: ` + extrarec.saldoDest + ' ' + circuittable.symbol + ']';
|
||||
console.log(msg);
|
||||
|
||||
ris.useraccounts = await Account.getUserAccounts(idapp, usernameOrig);
|
||||
@@ -772,23 +827,33 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
|
||||
let mittente = orig;
|
||||
|
||||
try {
|
||||
const paramsrec = {
|
||||
mittente, nomecircuito: circuittable.name,
|
||||
symbol: circuittable.symbol, qty: myqty,
|
||||
transactionDate: ris.rec.transactionDate,
|
||||
causale: extrarec.causal,
|
||||
causalDest: extrarec.causalDest,
|
||||
};
|
||||
if (extrarec.dest) {
|
||||
let myuserDest = await User.getUserByUsername(idapp, extrarec.dest);
|
||||
|
||||
// Invia una email al destinatario !
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, { mittente, nomecircuito: circuittable.name, symbol: circuittable.symbol, qty: myqty });
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, paramsrec);
|
||||
|
||||
} else if (extrarec.groupdest || extrarec.contoComDest) {
|
||||
const groupDestoContoCom = extrarec.groupdest ? extrarec.groupdest : (extrarec && extrarec.contoComDest ? extrarec.contoComDest : '');
|
||||
let arrusers = await MyGroup.getListAdminsByGroupName(idapp, groupDestoContoCom);
|
||||
if (arrusers.length <= 0)
|
||||
arrusers = await Circuit.getListAdminsByCircuitPath(idapp, groupDestoContoCom);
|
||||
|
||||
paramsrec.groupDestoContoCom = groupDestoContoCom;
|
||||
|
||||
for (let i = 0; i < arrusers.length; i++) {
|
||||
|
||||
let myuserDest = await User.getUserByUsername(idapp, arrusers[i].username);
|
||||
|
||||
// Invia una email al destinatario !
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, { mittente, nomecircuito: circuittable.name, symbol: circuittable.symbol, qty: myqty });
|
||||
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, paramsrec);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -914,6 +979,15 @@ CircuitSchema.statics.getNameByCircuitId = async function (circuitId) {
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
CircuitSchema.statics.getPathByCircuitName = async function (idapp, circuitName) {
|
||||
|
||||
let circuit = await Circuit.findOne({ idapp, name: circuitName }).lean();
|
||||
if (circuit)
|
||||
return '/' + shared_consts.getDirectoryByTable('circuits') + '/' + circuit.path;
|
||||
|
||||
return '';
|
||||
|
||||
};
|
||||
|
||||
CircuitSchema.statics.getCircuitByCircuitId = async function (circuitId) {
|
||||
@@ -932,7 +1006,9 @@ CircuitSchema.statics.getListAdminsByCircuitPath = async function (idapp, circui
|
||||
{ deleted: { $exists: true, $eq: false } }],
|
||||
}, { admins: 1 }).lean();
|
||||
|
||||
return arr && arr.admins ? arr.admins : [];
|
||||
let myarr = arr && arr.admins ? arr.admins : [];
|
||||
|
||||
return [...myarr, shared_consts.USER_ADMIN_CIRCUITS]
|
||||
|
||||
};
|
||||
|
||||
@@ -1036,7 +1112,7 @@ CircuitSchema.statics.getCircuitMyProvince = async function (idapp, username) {
|
||||
CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, province, card) {
|
||||
const { User } = require('../models/user');
|
||||
|
||||
const useradmin = tools.USER_ADMIN_CIRCUITS;
|
||||
const useradmin = shared_consts.USER_ADMIN_CIRCUITS;
|
||||
|
||||
let myrec = null;
|
||||
try {
|
||||
@@ -1067,6 +1143,9 @@ CircuitSchema.statics.createCircuitIfNotExist = async function (req, idapp, prov
|
||||
totCircolante: 0,
|
||||
date_created: new Date(),
|
||||
admins: [{ username: useradmin }],
|
||||
askManagerToEnter: false,
|
||||
sendEmailAfterAskingToEnter: false,
|
||||
circuitoIndipendente: false,
|
||||
});
|
||||
|
||||
myrec = await circ.save();
|
||||
@@ -1132,7 +1211,7 @@ CircuitSchema.statics.isAdminCircuit = async function (idapp, circuitname, usern
|
||||
|
||||
if (arr) {
|
||||
for (const admin of arr.admins) {
|
||||
if (admin.username === username)
|
||||
if ((admin.username === username) || (shared_consts.USER_ADMIN_CIRCUITS === username))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1262,7 +1341,7 @@ CircuitSchema.statics.setFido = async function (idapp, username, circuitName, gr
|
||||
|
||||
const ris = await Account.updateFido(idapp, username, groupname, circuitId, fido);
|
||||
if (ris) {
|
||||
return { qta_maxConcessa: qtamax, fidoConcesso: fido, changed: variato || (ris && ris.nModified > 0) };
|
||||
return { qta_maxConcessa: qtamax, fidoConcesso: fido, changed: variato || (ris && ris.modifiedCount > 0) };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1709,6 +1788,7 @@ CircuitSchema.statics.addMovementByOrdersCart = async function (ordersCart, user
|
||||
dest: usernameDest,
|
||||
groupdest: groupDest,
|
||||
contoComDest: '',
|
||||
causalDest: '',
|
||||
};
|
||||
|
||||
const usernameOrig = await User.getUsernameById(idapp, ordersCart.userId);
|
||||
@@ -1719,8 +1799,9 @@ CircuitSchema.statics.addMovementByOrdersCart = async function (ordersCart, user
|
||||
|
||||
const Circuit = mongoose.model('Circuit', CircuitSchema);
|
||||
|
||||
Circuit.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Circuit.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Circuit };
|
||||
|
||||
@@ -8,7 +8,7 @@ mongoose.level = 'F';
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
const fs = require('fs-extra');
|
||||
|
||||
@@ -200,7 +200,7 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
|
||||
CitySchema.statics.findAllIdApp = async function (idapp) {
|
||||
const myfind = {};
|
||||
|
||||
return await City.find(myfind);
|
||||
return await City.find(myfind).lean();
|
||||
};
|
||||
|
||||
CitySchema.statics.getGeoJsonByProvince = async function (prov) {
|
||||
@@ -256,7 +256,7 @@ CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
|
||||
|
||||
if (reccity) {
|
||||
const ris = await City.updateOne({ _id: reccity._id }, { $set: { geojson: citta } });
|
||||
if (ris.ok === 1) {
|
||||
if (ris.acknowledged) {
|
||||
inseriti++;
|
||||
}
|
||||
}
|
||||
@@ -274,8 +274,9 @@ CitySchema.statics.insertGeojsonToMongoDB = async function (nomefilejson) {
|
||||
|
||||
const City = mongoose.model('City', CitySchema);
|
||||
|
||||
City.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
City.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { City };
|
||||
|
||||
129
src/server/models/collana.js
Executable file
@@ -0,0 +1,129 @@
|
||||
mongoose = require('mongoose').set('debug', false)
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
});
|
||||
|
||||
const CollanaSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
idCollana: {
|
||||
type: Number,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
index: true,
|
||||
},
|
||||
dataOra: {
|
||||
type: Date,
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
},
|
||||
enabledAlFresco: {
|
||||
type: Boolean,
|
||||
},
|
||||
quanti: {
|
||||
type: Number,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var Collana = module.exports = mongoose.model('Collana', CollanaSchema);
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [
|
||||
{ field: 'title', type: tools.FieldType.string },
|
||||
]
|
||||
};
|
||||
|
||||
module.exports.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Collana.find(myfind).sort({title: 1}).lean();
|
||||
};
|
||||
|
||||
module.exports.getCollaneWithTitleCount = async function (idapp, updatedata) {
|
||||
try {
|
||||
|
||||
const myquery = [
|
||||
{ $match: { idapp } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'productinfos', // Nome della tua collezione productInfo
|
||||
localField: '_id',
|
||||
foreignField: 'idCollana',
|
||||
as: 'products'
|
||||
}
|
||||
},
|
||||
{
|
||||
$addFields: {
|
||||
myproducts: {
|
||||
$filter: {
|
||||
input: "$products",
|
||||
as: "prod",
|
||||
cond: {
|
||||
$in: ["$$prod.idStatoProdotto", [1, 4, 34, 45, 46]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
$project: {
|
||||
_id: 1,
|
||||
title: 1,
|
||||
idCollana: 1,
|
||||
dataOra: 1,
|
||||
quanti: { $size: '$myproducts' },
|
||||
products: {
|
||||
$map: {
|
||||
input: "$myproducts",
|
||||
as: "prod",
|
||||
in: {
|
||||
name: "$$prod.name"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ $match: { quanti: { $gt: 0 } } }, // esclude i record con quanti = 0
|
||||
{ $sort: { title: 1 } } // Ordina i risultati per nome
|
||||
];
|
||||
|
||||
const result = await Collana.aggregate(myquery);
|
||||
|
||||
if (updatedata) {
|
||||
for (const record of result) {
|
||||
await Collana.updateOne(
|
||||
{ _id: record._id },
|
||||
{ $set: { quanti: record.quanti } }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error('Error retrieving idCollana with title count:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
@@ -47,15 +47,14 @@ ContribtypeSchema.statics.findAllIdApp = async function (idapp) {
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Contribtype.find(myfind, (err, arrrec) => {
|
||||
return arrrec
|
||||
}).lean();
|
||||
return await Contribtype.find(myfind).lean();
|
||||
};
|
||||
|
||||
const Contribtype = mongoose.model('Contribtype', ContribtypeSchema);
|
||||
|
||||
Contribtype.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Contribtype.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Contribtype };
|
||||
|
||||
176
src/server/models/cron.js
Executable file
@@ -0,0 +1,176 @@
|
||||
const mongoose = require('mongoose').set('debug', false);
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
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 CronMod = require('../modules/CronMod');
|
||||
|
||||
const CronSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
nomeFunzioneDbOp: {
|
||||
type: String,
|
||||
},
|
||||
startTime: {
|
||||
// Orario iniziale (es. "08:30")
|
||||
type: String,
|
||||
},
|
||||
everyXMinutes: {
|
||||
// Esegui ogni X ore
|
||||
type: Number,
|
||||
},
|
||||
quanteVolteEseguito: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
quanteVolteEseguiAlGG: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
lastJobStarted: {
|
||||
type: Date,
|
||||
},
|
||||
lastJobEnd: {
|
||||
type: Date,
|
||||
},
|
||||
log: {
|
||||
type: String,
|
||||
},
|
||||
status: {
|
||||
type: Number,
|
||||
},
|
||||
date_created: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
},
|
||||
date_updated: {
|
||||
type: Date,
|
||||
},
|
||||
});
|
||||
|
||||
CronSchema.statics.getFieldsForSearch = function () {
|
||||
return [{ field: 'descr', type: tools.FieldType.string }];
|
||||
};
|
||||
|
||||
CronSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params, user);
|
||||
};
|
||||
|
||||
CronSchema.statics.startJobCron = async function (idapp) {
|
||||
// Esegui un loop su tutti i cron job che trovi per l'idapp specificato
|
||||
const Cron = this;
|
||||
try {
|
||||
const cronJobs = await Cron.find({ idapp, active: true });
|
||||
|
||||
// console.log('Check startJobCron...', idapp);
|
||||
|
||||
const mycronMod = new CronMod();
|
||||
|
||||
const currentDate = new Date();
|
||||
|
||||
for (const mycron of cronJobs) {
|
||||
const jobTime = new Date();
|
||||
const [hours, minutes] = mycron.startTime.split(':');
|
||||
jobTime.setHours(hours, minutes, 0, 0);
|
||||
|
||||
// Check if jobTime has passed and if 'everyXMinutes' have elapsed since last execution
|
||||
if (!mycron.quanteVolteEseguito) mycron.quanteVolteEseguito = 0;
|
||||
const timesPerDay = mycron.quanteVolteEseguiAlGG || 1;
|
||||
const startDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
||||
let lastJobDate = null;
|
||||
if (mycron.lastJobStarted) {
|
||||
lastJobDate = new Date(
|
||||
mycron.lastJobStarted.getFullYear(),
|
||||
mycron.lastJobStarted.getMonth(),
|
||||
mycron.lastJobStarted.getDate()
|
||||
);
|
||||
}
|
||||
|
||||
let tempooltre = currentDate - mycron.lastJobStarted >= mycron.everyXMinutes * 60 * 1000;
|
||||
const canExecute =
|
||||
(!mycron.lastJobStarted || // se non c'è un ultimo eseguito, esegui
|
||||
tempooltre) && // se è passato il tempo di attesa, esegui
|
||||
(mycron.lastJobStarted && (mycron.quanteVolteEseguito < timesPerDay) || // se non ho ancora raggiunto il numero di esecuzioni al giorno
|
||||
(!lastJobDate || (startDate.getTime() !== lastJobDate.getTime()))); // se non è lo stesso giorno, esegui
|
||||
if (canExecute) {
|
||||
if (currentDate >= jobTime) {
|
||||
// Execute the function at the scheduled time
|
||||
console.log(`Sto eseguendo il Cron Job: ${mycron.nomeFunzioneDbOp} alle ${currentDate.toLocaleTimeString()}`);
|
||||
const status = shared_consts.STATUS_JOB.START;
|
||||
if (!lastJobDate || startDate.getTime() !== lastJobDate.getTime()) {
|
||||
mycron.quanteVolteEseguito = 0;
|
||||
}
|
||||
|
||||
const quanteVolteEseguito = mycron.quanteVolteEseguito + 1;
|
||||
await Cron.findOneAndUpdate(
|
||||
{ _id: mycron._id },
|
||||
{ $set: { lastJobStarted: currentDate, status, quanteVolteEseguito } },
|
||||
{ new: true }
|
||||
);
|
||||
mycronMod
|
||||
.eseguiDbOp(idapp, { dbop: mycron.nomeFunzioneDbOp }, null, null)
|
||||
.then(async (ris) => {
|
||||
console.log(`${currentDate.toLocaleTimeString()} LOG JOB: ${ris.mystr}`);
|
||||
const myid = mycron._id;
|
||||
const status = shared_consts.STATUS_JOB.FINISH;
|
||||
const risupdate = await Cron.findOneAndUpdate(
|
||||
{ _id: myid },
|
||||
{ $set: { lastJobEnd: new Date(), status } },
|
||||
{ new: true }
|
||||
);
|
||||
})
|
||||
.catch(async (err) => {
|
||||
const log = "Errore durante l'esecuzione del job: " + err.message || err;
|
||||
const status = shared_consts.STATUS_JOB.ERR;
|
||||
await Cron.findOneAndUpdate({ _id: mycron._id }, { $set: { log, status } }, { new: true });
|
||||
console.error(log);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error startJobCron:', e);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
CronSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Cron = this;
|
||||
|
||||
try {
|
||||
return await Cron.find({ idapp }).then((arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Errore: ', err);
|
||||
}
|
||||
};
|
||||
|
||||
const Cron = mongoose.model('Cron', CronSchema);
|
||||
|
||||
Cron.createIndexes()
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
module.exports = { Cron };
|
||||
@@ -26,9 +26,10 @@ const departmentSchema = new Schema({
|
||||
|
||||
var Department = module.exports = mongoose.model('Department', departmentSchema);
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
module.exports.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return [{ field: 'name', type: tools.FieldType.string },
|
||||
@@ -44,6 +45,6 @@ module.exports.executeQueryTable = function (idapp, params) {
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Department.find(myfind);
|
||||
return await Department.find(myfind).lean();
|
||||
};
|
||||
|
||||
|
||||
59
src/server/models/destnewsletter.js
Executable file
@@ -0,0 +1,59 @@
|
||||
const 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 DestNewsletterSchema = new Schema({
|
||||
idapp: {
|
||||
type: String,
|
||||
},
|
||||
descr: {
|
||||
type: String,
|
||||
},
|
||||
tipodest_id: {
|
||||
type: Number,
|
||||
},
|
||||
});
|
||||
|
||||
DestNewsletterSchema.statics.getFieldsForSearch = function () {
|
||||
return []
|
||||
};
|
||||
|
||||
DestNewsletterSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
params.fieldsearch = this.getFieldsForSearch();
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
DestNewsletterSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
|
||||
|
||||
return await tools.DuplicateAllRecords(this, idapporig, idappdest);
|
||||
|
||||
};
|
||||
|
||||
|
||||
DestNewsletterSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const DestNewsletter = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
return await DestNewsletter.find(myfind).lean();
|
||||
};
|
||||
|
||||
|
||||
const DestNewsletter = mongoose.model('DestNewsletter', DestNewsletterSchema);
|
||||
|
||||
DestNewsletter.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { DestNewsletter };
|
||||
@@ -6,7 +6,7 @@ mongoose.level = "F";
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
const { ObjectId } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
@@ -106,8 +106,9 @@ DisciplineSchema.statics.DuplicateAllRecords = async function (idapporig, idappd
|
||||
|
||||
const Discipline = mongoose.model('Discipline', DisciplineSchema);
|
||||
|
||||
Discipline.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
Discipline.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports = { Discipline };
|
||||
|
||||