Non permettere il cambio del codice del gruppo
disattivare l'abilitazione se la registrazione arriva da me paoloar77 Sistemato il Menu del BOT per inviare msg a tutti e per ricevere il proprio Link personale. Non permettere il cambio del codice del gruppo Aggiunta la Provincia tra parentesi nei Comuni: es Rimini (RN)
This commit is contained in:
@@ -65,7 +65,7 @@ BotSchema.statics.findAllIdApp = async function(idapp) {
|
||||
|
||||
const myfind = {idapp};
|
||||
|
||||
return Bot.find(myfind).sort({page: 1, lang: 1, riga: 1, index: 1});
|
||||
return Bot.find(myfind).sort({page: 1, lang: 1, riga: 1, index: 1}).lean();
|
||||
};
|
||||
|
||||
const MyBot = mongoose.model('Bot', BotSchema);
|
||||
|
||||
@@ -114,24 +114,50 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
|
||||
}
|
||||
|
||||
let filterfindexact = {};
|
||||
if (strfind){
|
||||
if (strfind) {
|
||||
filterfindexact = {comune: strfind};
|
||||
}
|
||||
|
||||
let limit = 10
|
||||
let risexact = []
|
||||
|
||||
let limit = 10;
|
||||
let risexact = [];
|
||||
|
||||
let filterfind = {comune: {$regex: '^' + strfind, $options: 'i'}};
|
||||
|
||||
let aggr1 = [
|
||||
{
|
||||
$match: {comune: strfind},
|
||||
},
|
||||
{ $limit : 1 },
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (params.filter) {
|
||||
filterfind = {...params.filter, ...filterfind}
|
||||
limit = 200
|
||||
} else{
|
||||
risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
filterfind = {...params.filter, ...filterfind};
|
||||
limit = 200;
|
||||
} else {
|
||||
// risexact = await City.find(filterfindexact, {comune: 1, prov: 1, reg: 1}).lean();
|
||||
risexact = await City.aggregate(aggr1);
|
||||
}
|
||||
|
||||
let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(limit);
|
||||
let aggr2 = [
|
||||
{
|
||||
$match: filterfind,
|
||||
},
|
||||
{ $limit : limit },
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
// let ris = await City.find(filterfind, {comune: 1, prov: 1, reg: 1}).lean().limit(limit);
|
||||
let ris = await City.aggregate(aggr2).limit(limit);
|
||||
|
||||
return [...risexact, ...ris];
|
||||
|
||||
|
||||
@@ -145,6 +145,9 @@ const UserSchema = new mongoose.Schema({
|
||||
verified_by_aportador: {
|
||||
type: Boolean,
|
||||
},
|
||||
notask_verif: {
|
||||
type: Boolean,
|
||||
},
|
||||
trust_modified: {
|
||||
type: Date,
|
||||
},
|
||||
@@ -880,6 +883,24 @@ UserSchema.statics.setVerifiedByAportador = async function(
|
||||
return !!myrec;
|
||||
};
|
||||
|
||||
UserSchema.statics.setnotask_verif = async function(
|
||||
idapp, username, valuebool) {
|
||||
const User = this;
|
||||
|
||||
if (username === undefined)
|
||||
return false;
|
||||
|
||||
const myquery = {
|
||||
'idapp': idapp,
|
||||
'username': username,
|
||||
};
|
||||
|
||||
const myrec = await User.findOneAndUpdate(myquery,
|
||||
{$set: {'notask_verif': valuebool}}, {new: false});
|
||||
|
||||
return !!myrec;
|
||||
};
|
||||
|
||||
UserSchema.statics.setVerifiedByAportadorToALL = async function() {
|
||||
|
||||
return User.updateMany({}, {$set: {'verified_by_aportador': true}},
|
||||
@@ -1247,6 +1268,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
||||
sospeso: 1,
|
||||
verified_email: 1,
|
||||
verified_by_aportador: 1,
|
||||
notask_verif: 1,
|
||||
'profile.nationality': 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.biografia': 1,
|
||||
@@ -1641,6 +1663,7 @@ function getWhatToShow(idapp, username) {
|
||||
sospeso: 1,
|
||||
verified_email: 1,
|
||||
verified_by_aportador: 1,
|
||||
notask_verif: 1,
|
||||
'profile.nationality': 1,
|
||||
'profile.qualifica': 1,
|
||||
'profile.biografia': 1,
|
||||
@@ -1857,6 +1880,18 @@ UserSchema.statics.TelegIdByUsername = async function(idapp, username) {
|
||||
console.error('TelegIdByUsername', e);
|
||||
});
|
||||
};
|
||||
UserSchema.statics.notAsk_VerifByUsername = async function(idapp, username) {
|
||||
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, {'notask_verif': 1}).then((rec) => {
|
||||
return (!!rec && rec.notask_verif) ? true: false;
|
||||
}).catch((e) => {
|
||||
console.error('notAsk_VerifByUsername', e);
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
UserSchema.statics.SetTelegramCheckCode = async function(
|
||||
idapp, id, teleg_checkcode) {
|
||||
@@ -2124,7 +2159,7 @@ UserSchema.statics.getusersManagers = async function(idapp) {
|
||||
const User = this;
|
||||
|
||||
return User.find({idapp, 'profile.manage_telegram': true},
|
||||
{'profile.teleg_id': 1, perm: 1}).then((arrrec) => {
|
||||
{username: 1, 'profile.teleg_id': 1, perm: 1}).then((arrrec) => {
|
||||
return (!!arrrec) ? arrrec : null;
|
||||
}).catch((e) => {
|
||||
console.error('getusersManagers', e);
|
||||
@@ -2619,6 +2654,7 @@ UserSchema.statics.checkUser = async function(idapp, username) {
|
||||
return User.findOne({idapp, username}, {
|
||||
verified_email: 1,
|
||||
verified_by_aportador: 1,
|
||||
notask_verif: 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.teleg_checkcode': 1,
|
||||
}).then((rec) => {
|
||||
|
||||
Reference in New Issue
Block a user