- Aggiornato node.js alla versione 22.18.1

- Aggiornato tutti i pacchetti del server all'ultima versione.
- passato mongoose da versione 5 a versione 6
This commit is contained in:
Surya Paolo
2025-03-03 00:46:08 +01:00
parent 45d06b0923
commit 53a70a1c96
120 changed files with 3385 additions and 6065 deletions

View File

@@ -8,7 +8,7 @@ appTelegram_TEST=["1","13"]
appTelegram=["1","13"]
appTelegram_DEVELOP=["13"]
DOMAIN=mongodb://localhost:27017/
AUTH_MONGODB=1
AUTH_MONGODB=0
MONGODB_USER=admin
MONGODB_PWD=mypwadmin@1A
ENABLE_PUSHNOTIFICATION=1
@@ -32,7 +32,7 @@ GCM_API_KEY=""
PROD=0
PROJECT_DESCR_MAIN='__PROJECTS'
SECRK=Askb38v23jjDFaoskBOWj92axXCQ
TOKEN_LIFE=2h
TOKEN_LIFE=8h
REFRESH_TOKEN_LIFE=14d
FTPSERVER_HOST=139.162.166.31
FTPSERVER_PORT=21
@@ -41,4 +41,4 @@ 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"}]
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"
DS_API_KEY="sk-222e3addb3d8455d8b0516d93906eec7"

2
.vscode/launch.json vendored
View File

@@ -8,7 +8,7 @@
"name": "Launch via Nodemon",
"program": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"restart": true,
"runtimeExecutable": "/usr/local/bin/node",
"runtimeExecutable": " ",
"runtimeArgs": [
"--inspect=9229" // Use "--inspect=0.0.0.0:9229" for remote debugging
],

View File

@@ -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.&nbsp;</p>\n&nbsp; &nbsp;&nbsp;\n&nbsp; &nbsp; <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 nellambito delle proprie iniziative (profit e non profit) individuali o collettive.</p>\n\n\n&nbsp; &nbsp; <p>Larea 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&nbsp; &nbsp; <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&nbsp; &nbsp;&nbsp;\n&nbsp; &nbsp; <ul>\n&nbsp; &nbsp; &nbsp; &nbsp; <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 laffidabilità (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&nbsp; &nbsp; &nbsp; &nbsp; <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&nbsp; &nbsp; &nbsp; &nbsp; <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&nbsp; &nbsp; &nbsp; &nbsp; <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 dacqua e spiagge, presenza di inquinamento nellaria, … <strong>Accesso riservato</strong></li>\n&nbsp; &nbsp; </ul>\n&nbsp; &nbsp;&nbsp;\n&nbsp; &nbsp; <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",

View File

@@ -14,7 +14,7 @@ db.mygroups.insert(
"photos": [],
"admins": [
{
"_id": ObjectId("66e2e6276b502b07f1e89571"),
"_id": new ObjectId("66e2e6276b502b07f1e89571"),
"username": "paoloar77"
}
],

View File

@@ -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",

View File

@@ -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",

View File

@@ -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,

View File

@@ -1,10 +1,9 @@
module.exports = {
apps: [
{
name: "PRODUZIONE PiuCheBuono_ServerSide",
name: "PiuCheBuono",
script: "/var/www/nodejs_piuchebuono_server/src/server/server.js",
ignore_watch: ["node_modules", "logs"],
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
//autorestart: true,
instances: 1,
watch: false,

View File

@@ -1,7 +1,7 @@
module.exports = {
apps: [
{
name: "PRODUZIONE RISO - FREEPLANET",
name: "RISO",
script: "/var/www/nodejs_riso_server/src/server/server.js",
ignore_watch: ["node_modules", "logs"],
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",

View File

@@ -1,7 +1,7 @@
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",

View File

@@ -1,10 +1,10 @@
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,

2
filelog.txt Normal file
View File

@@ -0,0 +1,2 @@
Dom 02/03 ORE 16:32: USER [surya1977]: ciao

View File

@@ -423,4 +423,14 @@ Ven 28/02 ORE 19:40: [<b>Circuito RIS Bologna</b>]: Inviate Monete da surya1977
Saldi:
surya1977: 33.90 RIS]
SuryaSecondo: 2.10 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]

View File

@@ -13,78 +13,75 @@
"starttest": "NODE_ENV=test node src/server/server.js",
"test-watch": "nodemon --exec 'npm test'"
},
"engines": {
"node": "^18.19.0"
},
"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.4.7",
"ejs": "^3.1.8",
"email-templates": "^10.0.1",
"express": "^4.18.1",
"formidable": "^2.0.1",
"ejs": "^3.1.10",
"email-templates": "^12.0.2",
"express": "^4.21.2",
"formidable": "^3.5.2",
"ghostscript4js": "^3.2.3",
"i18n": "^0.15.0",
"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.0",
"mongoose": "^6.0.0",
"multer": "^1.4.5-lts.1",
"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",
"openai": "^4.83.0",
"node-telegram-bot-api": "^0.66.0",
"nodemailer": "^6.10.0",
"npm-check-updates": "^17.1.15",
"openai": "^4.86.1",
"pdf-lib": "^1.17.1",
"pdf-parse": "^1.1.1",
"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",
"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.0",
"jest": "^29.7.0",
"mocha": "^11.1.0",
"nodemon": "^3.1.9",
"supertest": "^7.0.0"
}
}

View File

@@ -1,20 +0,0 @@
{
"folders": [
{
"path": "../.."
},
{
"path": "../../../newfreeplanet"
},
{
"path": "../../../cnm"
}
],
"settings": {
"search.useIgnoreFiles": false,
"search.useParentIgnoreFiles": false,
"files.exclude": {
"": true
}
}
}

View File

@@ -1,52 +1,26 @@
var mongoose = require('mongoose').set('debug', false)
mongoose.Promise = global.Promise;
mongoose.level = "";
mongoose.plugin(schema => {
schema.options.usePushEach = true
});
mongoose.set('debug', false);
mongoose.set('strictQuery', false);
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.
// useNewUrlParser: true,
// useUnifiedTopology: true,
maxPoolSize: 5,
serverSelectionTimeoutMS: 30000,
};
console.log('process.env.AUTH_MONGODB', process.env.AUTH_MONGODB);
if (process.env.AUTH_MONGODB === '1') {
options.auth = {
/*options.auth = {
authSource: "admin",
poolSize: 10,
user: process.env.MONGODB_USER,
username: process.env.MONGODB_USER,
password: process.env.MONGODB_PWD,
};
};*/
}
if (options.auth && options.auth.user) {
@@ -61,8 +35,11 @@ console.log('Node Version ' + process.version);
console.log('Mongoose Version ' + mongoose.version);
connectionUrl = process.env.MONGODB_URI;
if (process.env.AUTH_MONGODB === '1') {
connectionUrl = `mongodb://${process.env.MONGODB_USER}:${process.env.MONGODB_PWD}@localhost:27017/test_FreePlanet`;
}
console.log('Connessione a ' + connectionUrl + ' in corso...');
console.log('Connessione a ' + connectionUrl + ' in corso...', options);
mongoose.connect(connectionUrl, options);
db.on('error', console.error.bind(console, 'connection error:'));

View File

@@ -98,9 +98,7 @@ 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) {
@@ -764,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 };

View File

@@ -64,8 +64,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};

View File

@@ -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};

View File

@@ -390,8 +390,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 };

View File

@@ -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; });

View File

@@ -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 };

View File

@@ -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 };

View File

@@ -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 };

View File

@@ -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,32 +89,35 @@ module.exports.getCartByUserId = async function (uid, idapp) {
};
module.exports.updateCartByUserId = function (userId, newCart, callback) {
module.exports.updateCartByUserId = async function (userId, newCart, callback) {
let query = { userId: userId };
Cart.find(query, function (err, c) {
try {
const c = await Cart.find(query);
} catch (err) {
if (err) throw err;
}
//exist cart in databse
if (c.length > 0) {
Cart.findOneAndUpdate(
{ userId: userId },
{
$set: {
items: newCart.items,
totalQty: newCart.totalQty,
totalPrice: newCart.totalPrice,
totalPriceCalc: newCart.totalPriceCalc,
userId: userId,
},
//exist cart in databse
if (c.length > 0) {
Cart.findOneAndUpdate(
{ userId: userId },
{
$set: {
items: newCart.items,
totalQty: newCart.totalQty,
totalPrice: newCart.totalPrice,
totalPriceCalc: newCart.totalPriceCalc,
userId: userId,
},
{ new: true },
callback,
);
} else {
//no cart in database
newCart.save(callback);
}
});
},
{ new: true },
callback,
);
} else {
//no cart in database
newCart.save(callback);
}
};
module.exports.updateCartByCartId = async function (cartId, newCart) {
@@ -148,7 +151,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 +159,7 @@ module.exports.createCart = async function (newCart) {
};
Cart.createIndexes((err) => {
if (err) throw err;
});
Cart.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -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 []

View File

@@ -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; });

View File

@@ -54,8 +54,9 @@ CatAISchema.statics.findAllIdApp = async function (idapp) {
const CatAI = mongoose.model('CatAI', CatAISchema);
CatAI.createIndexes((err) => {
if (err) throw err;
});
CatAI.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = CatAI;

View File

@@ -121,8 +121,9 @@ CatalogSchema.statics.findAllIdApp = async function (idapp) {
const Catalog = mongoose.model('Catalog', CatalogSchema);
Catalog.createIndexes((err) => {
if (err) throw err;
});
Catalog.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Catalog };

View File

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

View File

@@ -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 };

View File

@@ -90,9 +90,10 @@ CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp) {
const CatProd = mongoose.model('CatProd', CatProdSchema);
CatProd.createIndexes((err) => {
if (err) throw err;
});
CatProd.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = CatProd;

View File

@@ -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};

View File

@@ -607,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 });
};
@@ -1796,8 +1796,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 };

View File

@@ -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 };

View File

@@ -52,6 +52,7 @@ module.exports.findAllIdApp = async function (idapp) {
return await Collana.find(myfind).sort({title: 1}).lean();
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -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 };

View File

@@ -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 },

View File

@@ -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 };

View File

@@ -228,9 +228,8 @@ ExtraListSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await ExtraList.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, myfind);
};
ExtraListSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
@@ -332,9 +331,10 @@ ExtraListSchema.statics.ImportData = async function (locale, idapp, strdata) {
const ExtraList = mongoose.model('ExtraList', ExtraListSchema);
ExtraList.createIndexes((err) => {
if (err) throw err;
});
ExtraList.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { ExtraList };

View File

@@ -57,15 +57,14 @@ GallerySchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Gallery.find(myfind, (err, arrrec) => {
return arrrec
});
return await Gallery.find(myfind).lean();
};
const Gallery = mongoose.model('Gallery', GallerySchema);
Gallery.createIndexes((err) => {
if (err) throw err;
});
Gallery.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Gallery };

View File

@@ -78,6 +78,7 @@ module.exports.getGasordineByID = function (id, callback) {
Gasordine.findById(id, callback);
}
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

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

View File

@@ -312,9 +312,7 @@ GraduatoriaSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Graduatoria.find(myfind, (err, arrrec) => {
return arrrec
});
return await Graduatoria.find(myfind).lean();
};
GraduatoriaSchema.statics.isWorking = function (idapp) {
@@ -415,8 +413,9 @@ GraduatoriaSchema.statics.getPosizioneInGraduatoria = async function (idapp, ind
const Graduatoria = mongoose.model('Graduatoria', GraduatoriaSchema);
Graduatoria.createIndexes((err) => {
if (err) throw err;
});
Graduatoria.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Graduatoria };

View File

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

View File

@@ -226,6 +226,7 @@ module.exports.calculateHoursTodo = async function (idtodo) {
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -57,7 +57,10 @@ module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, deleted: false };
return await ImportaDescr.find(myfind, (err, arrrec) => {
return arrrec;
});
try {
return await ImportaDescr.find(myfind).lean();
} catch (err) {
console.error("Errore in ImportaDescr:", err);
return null;
}
};

View File

@@ -57,7 +57,10 @@ module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, deleted: false };
return await ImportaIsbn.find(myfind, (err, arrrec) => {
return arrrec;
});
try {
return await ImportaIsbn.find(myfind).lean();
} catch (err) {
console.error("Errore in ImportaIsbn:", err);
return null;
}
};

View File

@@ -57,7 +57,12 @@ module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, deleted: false };
return await ImportaMacro.find(myfind, (err, arrrec) => {
return arrrec;
});
try {
return await ImportaMacro.find(myfind).lean();
} catch (err) {
console.error("Errore in ImportaMacro:", err);
return null;
}
};

View File

@@ -53,7 +53,6 @@ module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp, deleted: false };
return await Inventariogm.find(myfind, (err, arrrec) => {
return arrrec;
});
return await tools.findAllQueryIdApp(Inventariogm, myfind);
};

View File

@@ -192,11 +192,10 @@ module.exports.findAllIdApp = async function(idapp) {
const myfind = {idapp};
return await IscrittiArcadei.find(myfind, (err, arrrec) => {
return arrrec;
});
return await tools.findAllQueryIdApp(this, myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -189,14 +189,12 @@ module.exports.findByEmail = function (idapp, email) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await IscrittiConacreis.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

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

View File

@@ -36,9 +36,7 @@ MailingListSchema.statics.findAllIdAppSubscribed = function (idapp) {
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return User.find(myfind, (err, arrrec) => {
return arrrec
});
return tools.findAllQueryIdApp(User, myfind);
};
MailingListSchema.statics.getnumSent = async function (idapp, idUser) {
@@ -62,12 +60,9 @@ MailingListSchema.statics.isOk = async function (idapp, iduser, idUser) {
MailingListSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await User.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(User, myfind);
};
MailingListSchema.statics.isUnsubscribed = async function (idapp, hash) {
@@ -84,15 +79,14 @@ MailingListSchema.statics.findByHash = function (idapp, hash) {
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return User.findOne(myfind, (err, rec) => {
return rec
});
return User.findOne(myfind).lean();
};
const MailingList = mongoose.model('MailingList', MailingListSchema);
User.createIndexes((err) => {
if (err) throw err;
});
User.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MailingList };

View File

@@ -72,9 +72,8 @@ MovementSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await MyMovement.find(myfind, (err, arrrec) => {
return arrrec;
});
return await tools.findAllQueryIdApp(MyMovement, myfind);
};
MovementSchema.pre('save', async function (next) {
@@ -1069,8 +1068,9 @@ MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz
const Movement = mongoose.model('Movement', MovementSchema);
Movement.createIndexes((err) => {
if (err) throw err;
});
Movement.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Movement };

View File

@@ -118,15 +118,15 @@ MsgTemplateSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await MsgTemplate.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, myfind);
};
const MsgTemplate = mongoose.model('MsgTemplate', MsgTemplateSchema);
MsgTemplate.createIndexes((err) => {
if (err) throw err;
});
MsgTemplate.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MsgTemplate };

View File

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

View File

@@ -532,8 +532,9 @@ MyElemSchema.statics.getNewFreeNameTemplate = async function (idapp, idPageOrig,
const MyElem = mongoose.model('MyElem', MyElemSchema);
MyElem.createIndexes((err) => {
if (err) throw err;
});
MyElem.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MyElem };

View File

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

View File

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

View File

@@ -378,7 +378,7 @@ MyGroupSchema.statics.getInfoGroupByGroupname = async function (idapp, groupname
MyGroupSchema.statics.deleteGroup = async function (idapp, usernameOrig, groupname) {
console.log('Gruppo ' + groupname + ' rimosso da ' + usernameOrig);
return await MyGroup.findOneAndRemove({ idapp, groupname });
return await MyGroup.findOneAndDelete({ idapp, groupname });
};
MyGroupSchema.statics.getGroupsByUsername = async function (idapp, username, req) {
@@ -674,8 +674,9 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
MyGroup.createIndexes((err) => {
if (err) throw err;
});
MyGroup.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MyGroup };

View File

@@ -347,17 +347,16 @@ MyHospSchema.statics.getCompleteRecord = function (idapp, id) {
};
MyHospSchema.statics.SettaAdTypeOffro_In_Hosps = function () {
MyHospSchema.statics.SettaAdTypeOffro_In_Hosps = async function () {
const MyHosp = this;
// Set all records 'adType' to shared_consts.AdType.OFFRO
MyHosp.updateMany({}, { $set: { adType: shared_consts.AdType.OFFRO } }, function (err, result) {
if (err) {
console.error('Error updating adType:', err);
} else {
console.log('Successfully updated adType for', result.nModified, 'records');
}
});
try {
// Set all records 'adType' to shared_consts.AdType.OFFRO
const result = await MyHosp.updateMany({}, { $set: { adType: shared_consts.AdType.OFFRO } });
console.log('Successfully updated adType for', result.nModified, 'records');
} catch (err) {
console.error('Error updating adType:', err);
}
};
MyHospSchema.statics.getProject = function () {
@@ -383,8 +382,9 @@ MyHospSchema.statics.getProject = function () {
const MyHosp = mongoose.model('MyHosp', MyHospSchema);
MyHosp.createIndexes((err) => {
if (err) throw err;
});
MyHosp.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MyHosp };

View File

@@ -164,9 +164,13 @@ MyPageSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await MyPage.find(myfind, (err, arrrec) => {
return arrrec
}).sort({ title: 1 }).lean();
try {
return await MyPage.find(myfind).sort({ title: 1 }).lean();
} catch (err) {
console.error("Errore in MyPage:", err, model);
return null;
}
};
MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
@@ -176,9 +180,15 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
{
idapp,
loadFirst: true,
},
(err, arrrec) => {
return arrrec
}).then(
(arrrec) => {
return arrrec
}
).catch((err) => {
if (err) {
console.error('findOnlyStruttRec', err);
throw err;
}
});
const arrfixed = await MyPage.find(
@@ -206,8 +216,14 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
loadFirst: 1,
mainMenu: 1,
sottoMenu: 1,
}, (err, arrrec) => {
}).then((arrrec) => {
return arrrec
}).catch((err) => {
if (err) {
console.error('findOnlyStruttRec', err);
throw err;
}
});
return [...arrFirst, ...arrfixed];
@@ -217,25 +233,32 @@ MyPageSchema.statics.findOnlyStruttRec = async function (idapp) {
MyPageSchema.statics.findInternalPages = async function (idapp) {
const MyPage = this;
const myfind = {
idapp,
internalpage: { $exists: true, $eq: true }
};
try {
const myfind = {
idapp,
internalpage: { $exists: true, $eq: true }
};
return await MyPage.find(myfind, {
title: 1,
path: 1,
onlyif_logged: 1,
only_residenti: 1,
}, (err, arrrec) => {
return arrrec
}).lean();
const result = await MyPage.find(myfind, {
title: 1,
path: 1,
onlyif_logged: 1,
only_residenti: 1,
}).lean();
return result;
} catch (err) {
console.log('findInternalPages', err);
throw err;
}
};
const MyPage = mongoose.model('MyPage', MyPageSchema);
MyPage.createIndexes((err) => {
if (err) throw err;
});
MyPage.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MyPage };

View File

@@ -158,8 +158,9 @@ MySchedaSchema.statics.findAllIdApp = async function (idapp) {
const MyScheda = mongoose.model('MyScheda', MySchedaSchema);
MyScheda.createIndexes((err) => {
if (err) throw err;
});
MyScheda.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa, IImg };

View File

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

View File

@@ -140,9 +140,8 @@ NewstosentSchema.statics.findAllIdApp = async function (idapp) {
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return await Newstosent.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, myfind);
};
NewstosentSchema.statics.getlast = async function (idapp) {
@@ -170,8 +169,9 @@ NewstosentSchema.statics.isActivated = async function (_id) {
const Newstosent = mongoose.model('Newstosent', NewstosentSchema);
Newstosent.createIndexes((err) => {
if (err) throw err;
});
Newstosent.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Newstosent };

View File

@@ -104,22 +104,15 @@ OperatorSchema.statics.executeQueryTable = function (idapp, params) {
};
OperatorSchema.statics.findAllIdApp = function (idapp) {
const Operator = this;
const myfind = { idapp };
// Extract only the Teacher where in the users table the field permissions is set 'Teacher' bit.
return Operator.find(myfind, (err, arrrec) => {
return arrrec
});
const query = this.find({ idapp }); // Crea la query
return query.exec(); // Esegui la query come promessa
};
const Operator = mongoose.model('Operator', OperatorSchema);
Operator.createIndexes((err) => {
if (err) throw err;
});
Operator.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Operator };

View File

@@ -35,16 +35,15 @@ OpzEmailSchema.statics.executeQueryTable = function (idapp, params) {
OpzEmailSchema.statics.findAllIdApp = async function (idapp) {
const OpzEmail = this;
return await OpzEmail.find({}, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, {});
};
const OpzEmail = mongoose.model('OpzEmail', OpzEmailSchema);
OpzEmail.createIndexes((err) => {
if (err) throw err;
});
OpzEmail.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { OpzEmail };

View File

@@ -131,9 +131,10 @@ const orderSchema = new Schema({
var Order = module.exports = mongoose.model('Order', orderSchema);
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports.getFieldsForSearch = function () {
return []
@@ -377,7 +378,7 @@ module.exports.updateTotals = function (order) {
module.exports.getTotalOrderById = async function (id) {
const query = [
{ $match: { _id: ObjectId(id) } },
{ $match: { _id: new ObjectId(id) } },
{
$lookup: {
from: 'products',
@@ -642,7 +643,7 @@ module.exports.RemoveDeletedOrdersInOrderscart = async function () {
if (!orderCart) {
// NON TROVATO ! Allora lo cancello
await Order.findOneAndRemove({ _id: ord._id });
await Order.findOneAndDelete({ _id: ord._id });
}
})
.catch(err => console.error(err));
@@ -660,7 +661,7 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
const myquery = [
{ $match: { idGasordine: ObjectId(myidGasordine) } },
{ $match: { idGasordine: new ObjectId(myidGasordine) } },
{
$lookup: {
from: 'products',

View File

@@ -198,7 +198,7 @@ module.exports.getRecCartByUserId = async function (uid, idapp, numorder) {
module.exports.getOrdersCartById = async function (id) {
let query = { _id: ObjectId(id) };
let query = { _id: new ObjectId(id) };
const arrris = await OrdersCart.getOrdersCartByQuery(query);
let myrec = arrris && arrris.length > 0 ? arrris[0] : null;
@@ -543,41 +543,44 @@ module.exports.getOrdersCartByUserId = async function (uid, idapp, numorder, fil
}
module.exports.updateOrdersCartById = function (id, newOrdersCart, callback) {
module.exports.updateOrdersCartById = async function(id, newOrdersCart, callback) {
let query = {
id,
deleted: false,
}
OrdersCart.find(query, function (err, c) {
if (err) throw err
try {
const c = await OrdersCart.find(query);
} catch (err) {
console.log('ERR: updateOrdersCartById', err);
if (err) throw err;
}
//exist cart in databse
if (c.length > 0) {
return OrdersCart.findOneAndUpdate(
{ _id: id },
{
$set: {
items: newOrdersCart.items,
totalQty: newOrdersCart.totalQty,
totalQtyPreordered: newOrdersCart.totalQtyPreordered,
totalPrice: newOrdersCart.totalPrice,
totalPriceCalc: newOrdersCart.totalPriceCalc ? newOrdersCart.totalPriceCalc : newOrdersCart.totalPrice,
userId: userId,
status: newOrdersCart.status,
numorder: newOrdersCart.numorder,
numord_pers: newOrdersCart.numord_pers,
note: newOrdersCart.note,
modify_at: new Date(),
}
},
{ new: true },
callback
)
} else {
//no cart in database
return newOrdersCart.save(callback)
}
})
//exist cart in databse
if (c.length > 0) {
return OrdersCart.findOneAndUpdate(
{ _id: id },
{
$set: {
items: newOrdersCart.items,
totalQty: newOrdersCart.totalQty,
totalQtyPreordered: newOrdersCart.totalQtyPreordered,
totalPrice: newOrdersCart.totalPrice,
totalPriceCalc: newOrdersCart.totalPriceCalc ? newOrdersCart.totalPriceCalc : newOrdersCart.totalPrice,
userId: userId,
status: newOrdersCart.status,
numorder: newOrdersCart.numorder,
numord_pers: newOrdersCart.numord_pers,
note: newOrdersCart.note,
modify_at: new Date(),
}
},
{ new: true },
callback
)
} else {
//no cart in database
return newOrdersCart.save(callback)
}
}
module.exports.setFieldInOrdersById = async function (objtoset, myOrderCart) {
@@ -616,10 +619,10 @@ module.exports.deleteRecsInOrdersById = async function (myOrderCart) {
let ris2 = null;
// Imposta su tutti i singoli prodotti ordinati (Order)
for (const recitem of myOrderCart.items) {
ris2 = await Order.findOneAndRemove({ _id: recitem.order._id })
ris2 = await Order.findOneAndDelete({ _id: recitem.order._id })
}
const ris = await OrdersCart.findOneAndRemove({ _id: myOrderCart._id })
const ris = await OrdersCart.findOneAndDelete({ _id: myOrderCart._id })
} catch (e) {
console.log('Err', e);
@@ -1045,19 +1048,6 @@ OrdersCartSchema.pre('save', async function (next) {
}
}
/*
if (user.isModified('password')) {
bcrypt.genSalt(10, (err, salt) => {
bcrypt.hash(user.password, salt, (err, hash) => {
user.password = hash;
next();
});
});
} else {
next();
}
*/
next();
} catch (e) {
console.error(e.message);
@@ -1171,6 +1161,7 @@ module.exports.getmsgorderTelegram = async function (ordersCart) {
}
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -38,15 +38,15 @@ PaymentTypeSchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await PaymentType.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, myfind);
};
const PaymentType = mongoose.model('Paymenttype', PaymentTypeSchema);
PaymentType.createIndexes((err) => {
if (err) throw err;
});
PaymentType.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { PaymentType };

View File

@@ -50,15 +50,14 @@ PermissionSchema.statics.findAllIdApp = async function () {
const myfind = {};
return await Permission.find(myfind, (err, arrrec) => {
return arrrec
});
return await tools.findAllQueryIdApp(this, {});
};
const Permission = mongoose.model('Permission', PermissionSchema);
Permission.createIndexes((err) => {
if (err) throw err;
});
Permission.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Permission };

View File

@@ -101,6 +101,7 @@ module.exports.getProducerByID = function (id, callback) {
// module.exports = { Producer };
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -764,9 +764,10 @@ module.exports.updateProductInOrder = async function (order) {
return order;
}
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports.convertAfterImportALLPROD = async function (idapp, dataObjects) {
@@ -841,18 +842,16 @@ module.exports.getArrCatProds = async function (idapp, cosa) {
{ $sort: { name: 1 } }
];
arr = await Product.aggregate(myquery, (err, result) => {
if (err) {
console.error(err);
// Gestisci l'errore come desideri
return [];
} else {
const uniqueCategories = result.map(category => category.name);
// console.log(uniqueCategories);
return uniqueCategories;
// Ora uniqueCategories contiene l'array delle categorie univoche utilizzate in tutti i prodotti con active = true
}
});
try {
let arr = [];
const result = await Product.aggregate(myquery);
arr = result.map(category => category.name);
return arr;
} catch (e) {
console.error('err', e);
}
// Ora uniqueCategories contiene l'array delle categorie univoche utilizzate in tutti i prodotti con active = true
return arr;
} catch (e) {
console.error('err', e);
@@ -1015,7 +1014,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
}
if (!tools.isObjectEmpty(objtoset)) {
ris = await Product.findOneAndUpdate({ _id: ObjectId(prod._id) }, { $set: objtoset })
ris = await Product.findOneAndUpdate({ _id: new ObjectId(prod._id) }, { $set: objtoset })
const objDelete = {
cat_name: 1,
@@ -1028,7 +1027,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro
gas_name: 1,
};
ris = await Product.updateOne({ _id: ObjectId(prod._id) }, { $unset: objDelete })
ris = await Product.updateOne({ _id: new ObjectId(prod._id) }, { $unset: objDelete })
if (ris && ris.nModified > 0) {
console.log('Modificato: ', objtoset.name);

View File

@@ -440,6 +440,7 @@ module.exports.correggiProductTypes = async function () {
}
}
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -298,7 +298,7 @@ ProjectSchema.statics.getIdParentByIdProj = function (idProj) {
console.log('INIT getIdParentByIdProj', idProj);
return Project.findOne({ '_id': ObjectId(idProj) }).then(rec => {
return Project.findOne({ '_id': new ObjectId(idProj) }).then(rec => {
if (!!rec) {
console.log('getIdParentByIdProj', rec.id_parent);
return rec.id_parent;
@@ -428,9 +428,10 @@ ProjectSchema.pre('save', function (next) {
var Project = mongoose.model('Projects', ProjectSchema);
Project.createIndexes((err) => {
if (err) throw err;
});
Project.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Project };

View File

@@ -59,6 +59,7 @@ module.exports.findAllIdApp = async function (idapp) {
return await Provider.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -152,8 +152,9 @@ ProvinceSchema.statics.setCoordinatesOnDB = async function () {
const Province = mongoose.model('Province', ProvinceSchema);
Province.createIndexes((err) => {
if (err) throw err;
});
Province.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Province };

View File

@@ -45,6 +45,7 @@ module.exports.findAllIdApp = async function (idapp) {
return await Publisher.find(myfind).sort({ name: 1 }).lean();
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -81,8 +81,9 @@ QueryAISchema.statics.executeQueryTable = function (idapp, params) {
const QueryAI = mongoose.model('QueryAI', QueryAISchema);
QueryAI.createIndexes((err) => {
if (err) throw err;
});
QueryAI.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { QueryAI };

View File

@@ -433,8 +433,9 @@ reactionSchema.statics.removeBookmark = async function (
const Reaction = mongoose.model('Reaction', reactionSchema);
Reaction.createIndexes((err) => {
if (err) throw err;
});
Reaction.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Reaction };

View File

@@ -57,6 +57,7 @@ module.exports.findAllIdApp = async function (idapp) {
return await Scontistica.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -38,16 +38,15 @@ searchSchema.statics.findAllByUserIdAndIdApp = function (userId, idapp, sall) {
else
myfind = { userId, idapp };
return Search.find(myfind, (err, arrsearch) => {
return arrsearch
});
return Search.find(myfind).lean();
};
const Search = mongoose.model('Search', searchSchema);
Search.createIndexes((err) => {
if (err) throw err;
});
Search.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Search };

View File

@@ -80,8 +80,9 @@ SectorActivitiesSchema.statics.executeQueryTable = function (idapp, params) {
const SectorActivities = mongoose.model('SectorActivities', SectorActivitiesSchema);
SectorActivities.createIndexes((err) => {
if (err) throw err;
});
SectorActivities.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { SectorActivities };

View File

@@ -80,8 +80,9 @@ SectorGoodSchema.statics.executeQueryTable = function (idapp, params) {
const SectorGood = mongoose.model('SectorGood', SectorGoodSchema);
SectorGood.createIndexes((err) => {
if (err) throw err;
});
SectorGood.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { SectorGood };

View File

@@ -109,8 +109,9 @@ sendmsgSchema.statics.findLastGroupByUserIdAndIdApp = function (userId, username
const SendMsg = mongoose.model('SendMsg', sendmsgSchema);
SendMsg.createIndexes((err) => {
if (err) throw err;
});
SendMsg.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { SendMsg };

View File

@@ -1383,8 +1383,9 @@ sendNotifSchema.statics.checkIfAlreadyExist = async function (idapp, tag, idpost
const SendNotif = mongoose.model('SendNotif', sendNotifSchema);
SendNotif.createIndexes((err) => {
if (err) throw err;
});
SendNotif.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { SendNotif: SendNotif };

View File

@@ -178,8 +178,9 @@ SettingsSchema.statics.getKeyNum = async function (idapp, key, mydefault) {
const Settings = mongoose.model('Settings', SettingsSchema);
Settings.createIndexes((err) => {
if (err) throw err;
});
Settings.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Settings };

View File

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

View File

@@ -272,7 +272,7 @@ module.exports.executeQueryTable = async function (idapp, params, userreq) {
if (myarr.length === 0) {
/* {
"_id" : ObjectId("620a71e194438ecd1acfdbca"),
"_id" : new ObjectId("620a71e194438ecd1acfdbca"),
"idapp" : "14",
"chiave" : "vers",
"userId" : "ALL",
@@ -429,6 +429,7 @@ module.exports.createFirstUserAdmin = async function () {
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -78,8 +78,9 @@ SkillSchema.statics.executeQueryTable = function (idapp, params) {
const Skill = mongoose.model('Skill', SkillSchema);
Skill.createIndexes((err) => {
if (err) throw err;
});
Skill.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Skill };

View File

@@ -172,8 +172,9 @@ StatSchema.statics.getStats = async function (idapp) {
const Stat = mongoose.model('Stat', StatSchema);
Stat.createIndexes((err) => {
if (err) throw err;
});
Stat.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Stat };

View File

@@ -75,8 +75,9 @@ StatusSkillSchema.statics.executeQueryTable = function (idapp, params) {
const StatusSkill = mongoose.model('StatusSkill', StatusSkillSchema);
StatusSkill.createIndexes((err) => {
if (err) throw err;
});
StatusSkill.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { StatusSkill };

View File

@@ -98,6 +98,7 @@ module.exports.findAllIdApp = async function (idapp) {
return await Storehouse.find(myfind);
};
module.exports.createIndexes((err) => {
if (err) throw err;
});
module.exports.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -60,9 +60,10 @@ SubCatProdSchema.statics.findAllIdApp = async function (idapp) {
const SubCatProd = mongoose.model('SubCatProd', SubCatProdSchema);
SubCatProd.createIndexes((err) => {
if (err) throw err;
});
SubCatProd.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = SubCatProd;

View File

@@ -26,6 +26,7 @@ const SubscriberSchema = new Schema({
var Subscription = module.exports = mongoose.model('subscribers', SubscriberSchema);
Subscription.createIndexes((err) => {
if (err) throw err;
});
Subscription.createIndexes()
.then(() => { })
.catch((err) => { throw err; });

View File

@@ -78,8 +78,9 @@ SubSkillSchema.statics.executeQueryTable = function (idapp, params) {
const SubSkill = mongoose.model('SubSkill', SubSkillSchema);
SubSkill.createIndexes((err) => {
if (err) throw err;
});
SubSkill.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { SubSkill };

View File

@@ -67,8 +67,9 @@ TemplEmailSchema.statics.findAllIdApp = async function (idapp) {
const TemplEmail = mongoose.model('TemplEmail', TemplEmailSchema);
TemplEmail.createIndexes((err) => {
if (err) throw err;
});
TemplEmail.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { TemplEmail };

View File

@@ -108,7 +108,7 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
var Todo = this;
let tofind = {
category: ObjectId(category),
category: new ObjectId(category),
$or:
[{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
@@ -126,9 +126,6 @@ TodoSchema.statics.findByUserIdAndIdParent = function (userId, category, phase =
};
// User.find({ admin: true }).where('created_at').gt(monthAgo).exec(function(err, users) {
// if (err) throw err;
function getQueryFilterTodo(userId) {
let myobj = [
// { userId: userId },
@@ -225,7 +222,7 @@ TodoSchema.statics.enabletoModify = async function (userId, idTodo) {
var Todo = this;
let params = {};
params['_id'] = ObjectId(idTodo);
params['_id'] = new ObjectId(idTodo);
const query = getQueryTodo(params, userId);
return Todo.aggregate(query)
@@ -519,9 +516,10 @@ TodoSchema.pre('save', function (next) {
var Todo = mongoose.model('Todos', TodoSchema);
Todo.createIndexes((err) => {
if (err) throw err;
});
Todo.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
module.exports = { Todo };

View File

@@ -771,7 +771,9 @@ UserSchema.statics.findByToken = async function (token, typeaccess, con_auth) {
check_expiry_date = true
}
if (check_expiry_date && (decoded.exp < Date.now() / 1000)) {
let tempo = Date.now() / 1000;
if (check_expiry_date && (decoded.exp < tempo)) {
console.log('Il token è scaduto, generazione del nuovo token...');
code = server_constants.RIS_CODE_HTTP_FORBIDDEN_TOKEN_EXPIRED;
} else {
@@ -4227,9 +4229,7 @@ UserSchema.statics.findAllIdApp = async function (idapp) {
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
};
return await User.find(myfind, (err, arrrec) => {
return arrrec;
});
return await tools.findAllQueryIdApp(this, myfind);
};
UserSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
@@ -4307,26 +4307,6 @@ UserSchema.statics.getDownline = async function (
}
};
/*
UserSchema.statics.fixUsername = async function (idapp, aportador_solidario_ind_order, username) {
const User = this;
// Check if somewhere there is my username
return User.find({ idapp, aportador_solidario_ind_order }, async (err, arrrec) => {
if (arrrec) {
for (const myuser of arrrec) {
if (!myuser.aportador_solidario || myuser.aportador_solidario === tools.APORTADOR_NONE) {
myuser.aportador_solidario = username;
await myuser.save()
}
}
}
});
};
*/
UserSchema.statics.findByCellAndNameSurname = function (
idapp, cell, name, surname) {
const User = this;
@@ -6324,9 +6304,10 @@ UserSchema.statics.createNewSubRecord = async function (idapp, req) {
const User = mongoose.model('User', UserSchema);
User.createIndexes((err) => {
if (err) throw err;
});
User.createIndexes()
.then(() => { })
.catch((err) => { throw err; });
class Hero {
constructor(name, level) {

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