diff --git a/src/modules/CronMod.js b/src/modules/CronMod.js index 04f6c66..c3ca470 100644 --- a/src/modules/CronMod.js +++ b/src/modules/CronMod.js @@ -199,6 +199,10 @@ class CronMod { ris = await User.setVerifiedByAportadorToALL(); } else if (mydata.dbop === 'RewriteContribType') { ris = populate.rewriteTable('contribtypes'); + } else if (mydata.dbop === 'RewriteCategESubCateg') { + const migration = require('../populate/migration-categories'); + + ris = await migration.aggiornaCategorieESottoCategorie() } else if (mydata.dbop === 'ReplaceUsername') { if (User.isAdmin(req.user.perm)) { ris = globalTables.replaceUsername(req.body.idapp, mydata.search_username, mydata.replace_username); diff --git a/src/populate/migration-categories.js b/src/populate/migration-categories.js index 36b6081..a208da8 100644 --- a/src/populate/migration-categories.js +++ b/src/populate/migration-categories.js @@ -441,6 +441,22 @@ async function migrateMyBacheca(MyBacheca) { console.log(`✅ MyBacheca: ${updated} aggiornati, ${unchanged} invariati`); } + +async function aggiornaCategorieESottoCategorie() { + console.log('\n Migrazione DIC 2025 da ESEGUIRE ----------- '); + await updateSkillSectors(Sector); + await updateSkills(Skill); + await updateSectorGoods(SectorGood); + await updateSectorBachecas(SectorBacheca); + await updateGoods(Good); + await updateBachecas(Bacheca); + + // const populate = require('./populate'); + + // ris = populate.rewriteTable('contribtypes'); + + return ris; +} // ============================================================================ // MAIN MIGRATION SCRIPT // ============================================================================ @@ -462,13 +478,7 @@ async function runMigration() { // Step 1: Aggiorna categorie solo 1 volta sola ! if (!isMigratioDic2025Executed) { - console.log('\n Migrazione DIC 2025 da ESEGUIRE ----------- '); - await updateSkillSectors(Sector); - await updateSkills(Skill); - await updateSectorGoods(SectorGood); - await updateSectorBachecas(SectorBacheca); - await updateGoods(Good); - await updateBachecas(Bacheca); + await aggiornaCategorieESottoCategorie(); } const myskill_updated = await Version.isTableVersionUpdated(idapp, 'myskill'); @@ -525,4 +535,5 @@ module.exports = { subSkillMapping, sectorGoodMapping, sectorBachecaMapping, + aggiornaCategorieESottoCategorie, }; diff --git a/src/populate/new_goods.js b/src/populate/new_goods.js index 84b960b..3b14459 100644 --- a/src/populate/new_goods.js +++ b/src/populate/new_goods.js @@ -82,5 +82,6 @@ module.exports = { { _id: 76, idSectorGood: [20], descr: 'Tradizionale', icon: 'fas fa-tractor' }, { _id: 77, idSectorGood: [20], descr: 'Viticoltura', icon: 'wine_bar' }, { _id: 78, idSectorGood: [20], descr: 'Acquacoltura', icon: 'fas fa-fish' }, + { _id: 79, idSectorGood: [2], descr: 'Casalinghi', icon: 'home_repair_service' }, ], }; diff --git a/src/populate/new_subskills.js b/src/populate/new_subskills.js index c65ca35..d756d33 100644 --- a/src/populate/new_subskills.js +++ b/src/populate/new_subskills.js @@ -74,6 +74,7 @@ module.exports = { { _id: 73, idSector: [7], descr: 'Lingue', icon: 'fas fa-language' }, { _id: 74, idSector: [7], descr: 'Scuola Libertaria', icon: 'fas fa-book-reader' }, { _id: 75, idSector: [7], descr: 'Consulenze Professionali', icon: 'fas fa-briefcase' }, + { _id: 76, idSector: [7], descr: 'Preparazione Esami', icon: 'school' }, // Energia e Sostenibilità { _id: 80, idSector: [8], descr: 'Biogas e Biomasse', icon: 'fas fa-fire' }, @@ -157,5 +158,6 @@ module.exports = { { _id: 177, idSector: [15], descr: 'Sport', icon: 'fas fa-running' }, { _id: 178, idSector: [15], descr: 'Teatro', icon: 'fas fa-theater-masks' }, { _id: 179, idSector: [15], descr: 'Altre Attività Culturali', icon: 'fas fa-question' }, + { _id: 180, idSector: [15], descr: 'Giochi da Tavolo', icon: 'extension' }, ], }; diff --git a/src/tools/globalTables.js b/src/tools/globalTables.js index ad1a614..032e39a 100755 --- a/src/tools/globalTables.js +++ b/src/tools/globalTables.js @@ -252,7 +252,7 @@ module.exports = { invia = true; } - if (recnotif.extrarec.send_email) { + if (recnotif.extrarec?.send_email) { params.typesend = params.typesend + shared_consts.TypeSend.EMAIL; } @@ -447,9 +447,9 @@ module.exports = { } const dati = { - usernameInvitante: paramsObj.extrarec.username_admin_abilitante, + usernameInvitante: paramsObj.extrarec?.username_admin_abilitante, nomeTerritorio: paramsObj.circuitnameDest, - link_group: paramsObj.extrarec.link_group, + link_group: paramsObj.extrarec?.link_group, }; await sendemail.sendEmail_Utente_Abilitato_Circuito_FidoConcesso(usertosend.lang, usertosend.email, usertosend, params.idapp, dati); }