categorie

This commit is contained in:
Surya Paolo
2025-12-07 15:17:42 +01:00
parent b35c99c8fb
commit b8dcd7f5e0
5 changed files with 28 additions and 10 deletions

View File

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

View File

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

View File

@@ -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' },
],
};

View File

@@ -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' },
],
};

View File

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