- MyProfile
- Immagine profilo e small
This commit is contained in:
@@ -865,7 +865,8 @@ UserSchema.statics.setUserQualified = async function(idapp, username) {
|
||||
return !!myrec;
|
||||
};
|
||||
|
||||
UserSchema.statics.setVerifiedByAportador = async function(idapp, username, valuebool) {
|
||||
UserSchema.statics.setVerifiedByAportador = async function(
|
||||
idapp, username, valuebool) {
|
||||
const User = this;
|
||||
|
||||
if (username === undefined)
|
||||
@@ -882,13 +883,13 @@ UserSchema.statics.setVerifiedByAportador = async function(idapp, username, valu
|
||||
return !!myrec;
|
||||
};
|
||||
|
||||
UserSchema.statics.setVerifiedByAportadorToALL = async function () {
|
||||
UserSchema.statics.setVerifiedByAportadorToALL = async function() {
|
||||
|
||||
return User.updateMany({}, {$set: {'verified_by_aportador': true}}, {new: false});
|
||||
return User.updateMany({}, {$set: {'verified_by_aportador': true}},
|
||||
{new: false});
|
||||
|
||||
};
|
||||
|
||||
|
||||
UserSchema.statics.setUserQualified_2Invitati = async function(
|
||||
idapp, username) {
|
||||
const User = this;
|
||||
@@ -1147,6 +1148,51 @@ UserSchema.statics.getUserById = function(idapp, id) {
|
||||
});
|
||||
};
|
||||
|
||||
UserSchema.statics.getUserProfileByUsername = async function(idapp, username) {
|
||||
|
||||
let perm = tools.Perm.PERM_ALL; //++Todo: sistemare
|
||||
|
||||
let whatToShow = {};
|
||||
|
||||
if (perm === tools.Perm.PERM_ALL) {
|
||||
whatToShow = {
|
||||
lang: 1,
|
||||
index: 1,
|
||||
username: 1,
|
||||
aportador_solidario: 1,
|
||||
name: 1,
|
||||
surname: 1,
|
||||
deleted: 1,
|
||||
sospeso: 1,
|
||||
verified_email: 1,
|
||||
verified_by_aportador: 1,
|
||||
'profile.nationality': 1,
|
||||
'profile.biografia': 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.username_telegram': 1,
|
||||
'profile.img': 1,
|
||||
'profile.sex': 1,
|
||||
'profile.dateofbirth': 1,
|
||||
'profile.born_city': 1,
|
||||
'profile.born_province': 1,
|
||||
'profile.born_country': 1,
|
||||
email: 1,
|
||||
date_reg: 1,
|
||||
img: 1,
|
||||
};
|
||||
}
|
||||
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, whatToShow).then((rec) => {
|
||||
return (rec._doc);
|
||||
}).catch((e) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.getAportadorSolidarioByUsername = async function(
|
||||
idapp, username) {
|
||||
const User = this;
|
||||
|
||||
Reference in New Issue
Block a user