Conto Comunitario...

This commit is contained in:
Surya Paolo
2023-01-12 01:03:10 +01:00
parent e13fe84709
commit f7d05eb856
6 changed files with 100 additions and 87 deletions

View File

@@ -1656,9 +1656,11 @@ UserSchema.statics.getUserProfileByUsername = async function (
'useraport.profile.img': 1,
};
}
let regexpusername = new RegExp(`^${username}$`, 'i');
const myfind = {
idapp, username,
idapp, username: { $regex: regexpusername },
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
};
@@ -4536,6 +4538,12 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave) {
const circuitobj = await Circuit.getCircuitsByUsername(idapp, recUser.username, recUser);
const useraccounts = await Account.getUserAccounts(idapp, recUser.username);
for (const group of listManageGroups) {
const myaccounts = await Account.getGroupAccounts(idapp, group.groupname);
if (myaccounts && myaccounts.length > 0)
group.account = myaccounts[0]
}
recUser.profile = { ...recUser.profile, ...circuitobj, useraccounts };