- comune residenza anche sulla email

This commit is contained in:
Surya Paolo
2025-11-27 01:28:25 +01:00
parent c46d23cb83
commit 33e51bac0e
5 changed files with 35 additions and 11 deletions

View File

@@ -317,6 +317,10 @@ html(lang="it")
.member-detail .member-detail
strong Email: strong Email:
| #{emailInvitato} | #{emailInvitato}
if userprofile && userprofile.profile.resid_str_comune && userprofile.profile.resid_province
.member-detail
strong Comune Residenza:
| #{userprofile.profile.resid_str_comune} (#{userprofile.profile.resid_province})
//- Domanda di conferma //- Domanda di conferma
.question-box .question-box

View File

@@ -158,6 +158,12 @@ html(lang="it")
.info-value .info-value
| #{user.profile.intcode_cell || ''} #{user.profile.cell || ''} | #{user.profile.intcode_cell || ''} #{user.profile.cell || ''}
if user && user.profile && (user.profile.resid_str_comune && user.profile.resid_province)
.info-row
.info-label Comune di Residenza:
.info-value
| #{user.profile.resid_str_comune || ''} (#{user.profile.resid_province || ''})
if user && user.profile && user.profile.nationality if user && user.profile && user.profile.nationality
.info-row .info-row
.info-label Nazionalità: .info-label Nazionalità:

View File

@@ -317,6 +317,10 @@ html(lang="it")
.member-detail .member-detail
strong Email: strong Email:
| #{emailInvitato} | #{emailInvitato}
if userprofile && userprofile.profile.resid_str_comune && userprofile.profile.resid_province
.member-detail
strong Comune Residenza:
| #{userprofile.profile.resid_str_comune} (#{userprofile.profile.resid_province})
//- Domanda di conferma //- Domanda di conferma
.question-box .question-box

View File

@@ -932,13 +932,12 @@ UserSchema.statics.findByToken = async function (
decoded, decoded,
token, token,
typeaccess, typeaccess,
browser_random, browser_random,
withuser, withuser,
withlean, withlean,
project project
); );
// Verifica scadenza token per idapp specifici // Verifica scadenza token per idapp specifici
if (user) { if (user) {
const checkExpiry = tools.getEnableTokenExpiredByIdApp(user.idapp); const checkExpiry = tools.getEnableTokenExpiredByIdApp(user.idapp);
@@ -4443,6 +4442,20 @@ UserSchema.statics.getNameSurnameEUsernameByUsername = async function (idapp, us
console.error('getNameSurnameByUsername', e); console.error('getNameSurnameByUsername', e);
}); });
}; };
UserSchema.statics.getProfileByUsername = async function (idapp, username, reale = false) {
const User = this;
return await User.findOne(
{
idapp,
username,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
},
{ profile: 1 }
).catch((e) => {
console.error('getNameSurnameByUsername', e);
});
};
UserSchema.statics.getIdByUsername = async function (idapp, username) { UserSchema.statics.getIdByUsername = async function (idapp, username) {
const User = this; const User = this;
@@ -6849,11 +6862,7 @@ UserSchema.statics.updateProvinceUserByComune = async function (idapp, userId, i
'profile.resid_province': recCity ? recCity.prov : '', 'profile.resid_province': recCity ? recCity.prov : '',
}; };
await User.findOneAndUpdate( await User.findOneAndUpdate({ _id: userId }, { $set: updateData }, { new: true });
{ _id: userId },
{ $set: updateData },
{ new: true }
);
// Ritorna i dati aggiornati nel formato che ti serve // Ritorna i dati aggiornati nel formato che ti serve
return { return {
@@ -6865,12 +6874,12 @@ UserSchema.statics.updateProvinceUserByComune = async function (idapp, userId, i
}; };
} catch (e) { } catch (e) {
console.error('Errore updateProvinceUserByComune', e.message); console.error('Errore updateProvinceUserByComune', e.message);
return { return {
_id: userId, _id: userId,
profile: { profile: {
resid_str_comune: '', resid_str_comune: '',
resid_province: '' resid_province: '',
} },
}; };
} }
}; };

View File

@@ -543,6 +543,7 @@ module.exports = {
usernameInvitante: user.aportador_solidario, usernameInvitante: user.aportador_solidario,
nomeInvitante: nomecognomeInvitante.trim(), nomeInvitante: nomecognomeInvitante.trim(),
nomeInvitato: await User.getNameSurnameEUsernameByUsername(idapp, user.username), nomeInvitato: await User.getNameSurnameEUsernameByUsername(idapp, user.username),
userprofile: await User.getProfileByUsername(idapp, user.username),
usernameInvitato: user.username, usernameInvitato: user.username,
emailInvitato: user.email, emailInvitato: user.email,
user, user,