- 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
strong Email:
| #{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
.question-box

View File

@@ -158,6 +158,12 @@ html(lang="it")
.info-value
| #{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
.info-row
.info-label Nazionalità:

View File

@@ -317,6 +317,10 @@ html(lang="it")
.member-detail
strong Email:
| #{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
.question-box

View File

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

View File

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