Protetto le password (al load) che vengono settate in settings
This commit is contained in:
@@ -40,7 +40,7 @@ ContribtypeSchema.statics.DuplicateAllRecords = async function (idapporig, idapp
|
||||
};
|
||||
|
||||
|
||||
ContribtypeSchema.statics.findAllIdApp = function (idapp) {
|
||||
ContribtypeSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Contribtype = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -55,7 +55,7 @@ const DisciplineSchema = new Schema({
|
||||
}],
|
||||
});
|
||||
|
||||
DisciplineSchema.statics.findAllIdApp = function (idapp) {
|
||||
DisciplineSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Discipline = this;
|
||||
|
||||
const query = [
|
||||
|
||||
@@ -222,7 +222,7 @@ ExtraListSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
ExtraListSchema.statics.findAllIdApp = function (idapp) {
|
||||
ExtraListSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const ExtraList = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -208,7 +208,7 @@ FlottaSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
FlottaSchema.statics.findAllIdApp = function (idapp) {
|
||||
FlottaSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Flotta = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -308,7 +308,7 @@ GraduatoriaSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
GraduatoriaSchema.statics.findAllIdApp = function (idapp) {
|
||||
GraduatoriaSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Graduatoria = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -48,7 +48,7 @@ LevelSchema.pre('save', async function (next) {
|
||||
});
|
||||
|
||||
|
||||
LevelSchema.statics.findAllIdApp = function(idapp) {
|
||||
LevelSchema.statics.findAllIdApp = async function(idapp) {
|
||||
const Level = this;
|
||||
|
||||
const query = [
|
||||
|
||||
@@ -529,7 +529,7 @@ ListaIngressoSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
ListaIngressoSchema.statics.findAllIdApp = function (idapp) {
|
||||
ListaIngressoSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const ListaIngresso = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -139,7 +139,7 @@ const MyEventSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
MyEventSchema.statics.findAllIdApp = function(socioresidente, idapp) {
|
||||
MyEventSchema.statics.findAllIdApp = async function(socioresidente, idapp) {
|
||||
const Event = this;
|
||||
|
||||
let query = [];
|
||||
|
||||
@@ -89,7 +89,7 @@ MySkillSchema.pre('save', async function(next) {
|
||||
next();
|
||||
});
|
||||
|
||||
MySkillSchema.statics.findAllIdApp = function(idapp) {
|
||||
MySkillSchema.statics.findAllIdApp = async function(idapp) {
|
||||
|
||||
const query = [
|
||||
{$match: {idapp}},
|
||||
|
||||
@@ -190,7 +190,7 @@ NaveSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
NaveSchema.statics.findAllIdApp = function (idapp) {
|
||||
NaveSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Nave = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -181,7 +181,7 @@ NavePersistenteSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
NavePersistenteSchema.statics.findAllIdApp = function (idapp) {
|
||||
NavePersistenteSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const NavePersistente = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -133,7 +133,7 @@ NewstosentSchema.statics.findNewsletterPending_To_Send = function (idapp) {
|
||||
});
|
||||
};
|
||||
|
||||
NewstosentSchema.statics.findAllIdApp = function (idapp) {
|
||||
NewstosentSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Newstosent = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -97,7 +97,7 @@ OperatorSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
OperatorSchema.statics.findAllIdApp = function (idapp) {
|
||||
OperatorSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Operator = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -33,7 +33,7 @@ PaymentTypeSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
PaymentTypeSchema.statics.findAllIdApp = function (idapp) {
|
||||
PaymentTypeSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const PaymentType = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
@@ -45,7 +45,7 @@ PermissionSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, 0, params);
|
||||
};
|
||||
|
||||
PermissionSchema.statics.findAllIdApp = function () {
|
||||
PermissionSchema.statics.findAllIdApp = async function () {
|
||||
const Permission = this;
|
||||
|
||||
const myfind = { };
|
||||
|
||||
@@ -56,7 +56,7 @@ SectorSchema.pre('save', async function (next) {
|
||||
next();
|
||||
});
|
||||
|
||||
SectorSchema.statics.findAllIdApp = function (idapp) {
|
||||
SectorSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Sector = this;
|
||||
|
||||
const query = [
|
||||
|
||||
@@ -39,6 +39,10 @@ const SettingsSchema = new Schema({
|
||||
serv: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
crypted: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,6 +67,8 @@ SettingsSchema.statics.getValDbSettings = function (idapp, key, def) {
|
||||
return myrec.value_num;
|
||||
else if (myrec.type === tools.FieldType.boolean)
|
||||
return myrec.value_bool;
|
||||
else if (myrec.type === tools.FieldType.crypted)
|
||||
return tools.decryptdata(myrec.value_str);
|
||||
else
|
||||
return myrec.value_str;
|
||||
} else {
|
||||
@@ -82,18 +88,35 @@ SettingsSchema.statics.DuplicateAllRecords = async function (idapporig, idappdes
|
||||
|
||||
};
|
||||
|
||||
SettingsSchema.statics.findAllIdApp = function (idapp, serv) {
|
||||
SettingsSchema.statics.findAllIdApp = async function (idapp, serv, crypted = false) {
|
||||
const Settings = this;
|
||||
|
||||
let myfind = '';
|
||||
if (serv)
|
||||
myfind = { idapp, serv };
|
||||
else
|
||||
if (serv) {
|
||||
myfind = {idapp, serv };
|
||||
} else
|
||||
myfind = { idapp };
|
||||
|
||||
return Settings.find(myfind, (err, arrrec) => {
|
||||
// myfind = {...myfind, $or: [{ crypted: { $exists: false } }, { crypted: { $exists: true, $eq: crypted } }]};
|
||||
|
||||
const arrorig = await Settings.find(myfind, (err, arrrec) => {
|
||||
return arrrec
|
||||
});
|
||||
|
||||
let myarr = []
|
||||
|
||||
if (!crypted) {
|
||||
arrorig.forEach((rec) => {
|
||||
if (rec.crypted) {
|
||||
rec._doc.value_str = ''
|
||||
}
|
||||
myarr.push({...rec._doc});
|
||||
})
|
||||
} else {
|
||||
myarr = [...arrorig];
|
||||
}
|
||||
|
||||
return myarr;
|
||||
};
|
||||
|
||||
SettingsSchema.statics.setKeyNum = async function (idapp, key, value) {
|
||||
|
||||
@@ -31,7 +31,7 @@ const SkillSchema = new Schema({
|
||||
},
|
||||
});
|
||||
|
||||
SkillSchema.statics.findAllIdApp = function (idapp) {
|
||||
SkillSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Skill = this;
|
||||
|
||||
const query = [
|
||||
|
||||
@@ -45,7 +45,7 @@ StatusSkillSchema.pre('save', async function (next) {
|
||||
|
||||
|
||||
|
||||
StatusSkillSchema.statics.findAllIdApp = function (idapp) {
|
||||
StatusSkillSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const StatusSkill = this;
|
||||
|
||||
const query = [
|
||||
|
||||
@@ -364,7 +364,7 @@ UserSchema.statics.setZoomPresenza = async function(idapp, id, presenza) {
|
||||
allData.precDataUser = await User.getInfoUser(idapp,
|
||||
allData.myuser.username);
|
||||
|
||||
return await User.findByIdAndUpdate(id,
|
||||
return User.findByIdAndUpdate(id,
|
||||
{$set: {'profile.saw_zoom_presentation': presenza}}).then((rec) => {
|
||||
if (presenza) {
|
||||
const messaggio = tools.get__('ZOOM_CONFERMATO');
|
||||
@@ -1086,7 +1086,7 @@ UserSchema.methods.removeToken = function(token) {
|
||||
UserSchema.statics.getEmailByUsername = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}).then((arrrec) => {
|
||||
@@ -1099,7 +1099,7 @@ UserSchema.statics.getEmailByUsername = async function(idapp, username) {
|
||||
UserSchema.statics.getUsernameById = async function(idapp, id) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, _id: id,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, {username: 1}).then((myuser) => {
|
||||
@@ -1122,7 +1122,7 @@ UserSchema.statics.getAportadorSolidarioByUsername = async function(
|
||||
idapp, username) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}).then((rec) => {
|
||||
@@ -1135,7 +1135,7 @@ UserSchema.statics.getAportadorSolidarioByUsername = async function(
|
||||
UserSchema.statics.UserByIdTelegram = async function(idapp, teleg_id) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, 'profile.teleg_id': teleg_id,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}).then((rec) => {
|
||||
@@ -1148,7 +1148,7 @@ UserSchema.statics.UserByIdTelegram = async function(idapp, teleg_id) {
|
||||
UserSchema.statics.UsersByIdTelegram = async function(idapp, teleg_id) {
|
||||
const User = this;
|
||||
|
||||
return await User.find({
|
||||
return User.find({
|
||||
idapp, 'profile.teleg_id': teleg_id,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}).then((rec) => {
|
||||
@@ -1161,7 +1161,7 @@ UserSchema.statics.UsersByIdTelegram = async function(idapp, teleg_id) {
|
||||
UserSchema.statics.TelegIdByUsername = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, {'profile.teleg_id': 1}).then((rec) => {
|
||||
@@ -1179,7 +1179,7 @@ UserSchema.statics.SetTelegramCheckCode = async function(
|
||||
'profile.teleg_checkcode': teleg_checkcode,
|
||||
};
|
||||
|
||||
return await User.findOneAndUpdate({
|
||||
return User.findOneAndUpdate({
|
||||
_id: id,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
return !!record;
|
||||
@@ -1194,7 +1194,7 @@ UserSchema.statics.NonVoglioImbarcarmi = async function(idapp, username) {
|
||||
non_voglio_imbarcarmi: true,
|
||||
};
|
||||
|
||||
return await User.findOneAndUpdate({
|
||||
return User.findOneAndUpdate({
|
||||
idapp,
|
||||
username,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
@@ -1212,7 +1212,7 @@ UserSchema.statics.SetTelegramIdSuccess = async function(idapp, id, teleg_id) {
|
||||
'profile.teleg_checkcode': 0,
|
||||
};
|
||||
|
||||
return await User.findOneAndUpdate({
|
||||
return User.findOneAndUpdate({
|
||||
idapp,
|
||||
_id: id,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
@@ -1236,7 +1236,7 @@ UserSchema.statics.SetLang = async function(idapp, id, lang) {
|
||||
lang,
|
||||
};
|
||||
|
||||
return await User.findOneAndUpdate({
|
||||
return User.findOneAndUpdate({
|
||||
_id: id,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
return record;
|
||||
@@ -1267,7 +1267,7 @@ UserSchema.statics.SetTelegramWasBlocked = async function(idapp, teleg_id) {
|
||||
UserSchema.statics.getNameSurnameByUsername = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, {name: 1, surname: 1}).then((rec) => {
|
||||
@@ -1280,7 +1280,7 @@ UserSchema.statics.getNameSurnameByUsername = async function(idapp, username) {
|
||||
UserSchema.statics.getNameSurnameById = async function(idapp, userId) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp,
|
||||
_id: userId,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
@@ -1384,7 +1384,7 @@ UserSchema.statics.getRecByIndOrder = async function(idapp, ind_order) {
|
||||
UserSchema.statics.getusersManagers = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return await User.find({idapp, 'profile.manage_telegram': true},
|
||||
return User.find({idapp, 'profile.manage_telegram': true},
|
||||
{'profile.teleg_id': 1, perm: 1}).then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).catch((e) => {
|
||||
@@ -1395,7 +1395,7 @@ UserSchema.statics.getusersManagers = async function(idapp) {
|
||||
UserSchema.statics.getusersRespList = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return await User.find({idapp, 'profile.resplist': true},
|
||||
return User.find({idapp, 'profile.resplist': true},
|
||||
{_id: 1, username: 1, name: 1, surname: 1}).then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).catch((e) => {
|
||||
@@ -1406,7 +1406,7 @@ UserSchema.statics.getusersRespList = async function(idapp) {
|
||||
UserSchema.statics.getusersWorkersList = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return await User.find({idapp, 'profile.workerslist': true},
|
||||
return User.find({idapp, 'profile.workerslist': true},
|
||||
{_id: 1, username: 1, name: 1, surname: 1}).then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).catch((e) => {
|
||||
@@ -1417,7 +1417,7 @@ UserSchema.statics.getusersWorkersList = async function(idapp) {
|
||||
UserSchema.statics.getusersManagersAndZoomeri = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return await User.find(
|
||||
return User.find(
|
||||
{
|
||||
idapp,
|
||||
or: [
|
||||
@@ -1444,7 +1444,7 @@ UserSchema.statics.getUsersTelegALL = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
if (!!username) {
|
||||
return await User.find({idapp, username, 'profile.teleg_id': {$gt: 0}}).
|
||||
return User.find({idapp, username, 'profile.teleg_id': {$gt: 0}}).
|
||||
then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).
|
||||
@@ -1452,7 +1452,7 @@ UserSchema.statics.getUsersTelegALL = async function(idapp, username) {
|
||||
console.error('getUsersTelegALL', e);
|
||||
});
|
||||
} else {
|
||||
return await User.find({idapp, 'profile.teleg_id': {$gt: 0}}).
|
||||
return User.find({idapp, 'profile.teleg_id': {$gt: 0}}).
|
||||
then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).
|
||||
@@ -1466,7 +1466,7 @@ UserSchema.statics.getUsersTelegALL = async function(idapp, username) {
|
||||
UserSchema.statics.isManagerByIdTeleg = async function(idapp, idtelegram) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp,
|
||||
'profile.manage_telegram': true,
|
||||
'profile.teleg_id': idtelegram,
|
||||
@@ -1481,7 +1481,7 @@ UserSchema.statics.isManagerByIdTeleg = async function(idapp, idtelegram) {
|
||||
UserSchema.statics.isAdminByIdTeleg = async function(idapp, idtelegram) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({
|
||||
return User.findOne({
|
||||
idapp,
|
||||
username: 'paoloar77',
|
||||
'profile.manage_telegram': true,
|
||||
@@ -1545,7 +1545,7 @@ UserSchema.statics.executeQueryTable = function(idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
UserSchema.statics.findAllIdApp = function(idapp) {
|
||||
UserSchema.statics.findAllIdApp = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
const myfind = {
|
||||
@@ -1767,7 +1767,7 @@ UserSchema.statics.getUsersRegistered = async function(idapp) {
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1962,7 +1962,7 @@ UserSchema.statics.getEmailNotVerified = async function(idapp) {
|
||||
verified_email: false,
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersTelegramAttivo = async function(idapp) {
|
||||
@@ -1974,7 +1974,7 @@ UserSchema.statics.getUsersTelegramAttivo = async function(idapp) {
|
||||
'profile.teleg_id': {$gt: 0},
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersTelegramPending = async function(idapp) {
|
||||
@@ -1986,7 +1986,7 @@ UserSchema.statics.getUsersTelegramPending = async function(idapp) {
|
||||
'profile.teleg_checkcode': {$gt: 0},
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersZoom = async function(idapp) {
|
||||
@@ -1998,7 +1998,7 @@ UserSchema.statics.getUsersZoom = async function(idapp) {
|
||||
'profile.saw_zoom_presentation': true,
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersResidenti = async function(idapp) {
|
||||
@@ -2010,7 +2010,7 @@ UserSchema.statics.getUsersResidenti = async function(idapp) {
|
||||
'profile.socioresidente': {$exists: true, $eq: true},
|
||||
};
|
||||
|
||||
return await User.find(myfind, {username: 1, name: 1, surname: 1});
|
||||
return User.find(myfind, {username: 1, name: 1, surname: 1});
|
||||
};
|
||||
|
||||
UserSchema.statics.getSaw_and_Accepted = async function(idapp) {
|
||||
@@ -2022,7 +2022,7 @@ UserSchema.statics.getSaw_and_Accepted = async function(idapp) {
|
||||
'profile.saw_and_accepted': shared_consts.ALL_SAW_AND_ACCEPTED,
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getUsersDreams = async function(idapp) {
|
||||
@@ -2035,7 +2035,7 @@ UserSchema.statics.getUsersDreams = async function(idapp) {
|
||||
'$expr': {'$gt': [{'$strLenCP': '$profile.my_dream'}, 10]},
|
||||
};
|
||||
|
||||
return await User.count(myfind);
|
||||
return User.count(myfind);
|
||||
};
|
||||
|
||||
UserSchema.statics.getLastUsers = async function(idapp) {
|
||||
@@ -2043,7 +2043,7 @@ UserSchema.statics.getLastUsers = async function(idapp) {
|
||||
|
||||
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_USERS', 5);
|
||||
|
||||
return await User.find(
|
||||
return User.find(
|
||||
{
|
||||
idapp,
|
||||
$or: [
|
||||
@@ -2067,7 +2067,7 @@ UserSchema.statics.getLastUsers = async function(idapp) {
|
||||
UserSchema.statics.checkUser = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
return await User.findOne({idapp, username}, {
|
||||
return User.findOne({idapp, username}, {
|
||||
verified_email: 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.teleg_checkcode': 1,
|
||||
@@ -2213,7 +2213,7 @@ UserSchema.statics.getnumRegNDays = function(idapp, nrec) {
|
||||
UserSchema.statics.calcnumRegUntilDay = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return await User.aggregate(User.getnumRegNDays(idapp, 30)).then((arr) => {
|
||||
return User.aggregate(User.getnumRegNDays(idapp, 30)).then((arr) => {
|
||||
return arr.reduce((sum, rec) => sum + rec.count, 0);
|
||||
});
|
||||
|
||||
@@ -2456,12 +2456,10 @@ UserSchema.statics.checkIfSbloccatiRequisiti = async function(
|
||||
!await User.isUserAlreadyQualified_2Invitati(idapp,
|
||||
allData.myuser.username)) {
|
||||
await User.setUserQualified_2Invitati(idapp, allData.myuser.username);
|
||||
|
||||
// ORA HAI I 9 REQUISITI !
|
||||
const msgtext = telegrambot.getCiao(idapp, allData.myuser.username,
|
||||
allData.myuser.lang) +
|
||||
tools.gettranslate('HAI_I_9_REQUISITI', allData.myuser.lang);
|
||||
telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext,
|
||||
false); // Anche a STAFF
|
||||
// const msgtext = telegrambot.getCiao(idapp, allData.myuser.username, allData.myuser.lang) + tools.gettranslate('HAI_I_9_REQUISITI', allData.myuser.lang);
|
||||
// telegrambot.sendMsgTelegram(idapp, allData.myuser.username, msgtext, false); // Anche a STAFF
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2655,7 +2653,7 @@ UserSchema.statics.DbOp = async function(idapp, mydata) {
|
||||
|
||||
return {num};
|
||||
|
||||
// return await User.updateMany({ idapp }, { $set: { 'profile.cell': { $concat: ["$profile.intcode_cell", "$profile.cell"] } } })
|
||||
// return User.updateMany({ idapp }, { $set: { 'profile.cell': { $concat: ["$profile.intcode_cell", "$profile.cell"] } } })
|
||||
} else if (mydata.dbop === 'changeEmailLowerCase') {
|
||||
arrusers = await User.find({'idapp': idapp});
|
||||
let num = 0;
|
||||
|
||||
@@ -39,7 +39,7 @@ WhereSchema.statics.executeQueryTable = function (idapp, params) {
|
||||
return tools.executeQueryTable(this, idapp, params);
|
||||
};
|
||||
|
||||
WhereSchema.statics.findAllIdApp = function (idapp) {
|
||||
WhereSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Where = this;
|
||||
|
||||
const myfind = { idapp };
|
||||
|
||||
Reference in New Issue
Block a user