Aggiunto messaggio nella registrazione, dicendo che occorre avere Telegram installato.
PASSARE TUTTI I _DOC e mettergli .lean() prima dello then() -> velocizza le Query di Mongodb "Floriterapia costellazioni familiari coach motivazionale Tecniche Essene" Inserimento Gruppi: anche il comune obbligatorio Far comparire le ultime persone registrate Mettere il controllo dell'abilitazione del BOT Telegram solo dopo che conosco il suo username, e cosi gli metto anche il contatto telegram. risolto foto profilo di telegram che non si salvava in automatico tolto il controllo della email aggiunto msg se errore al server, installare altro browser.
This commit is contained in:
@@ -4,6 +4,7 @@ const validator = require('validator');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const _ = require('lodash');
|
||||
|
||||
|
||||
const tools = require('../tools/general');
|
||||
|
||||
const {Settings} = require('../models/settings');
|
||||
@@ -996,7 +997,7 @@ UserSchema.statics.getindOrderDuplicate = function(idapp) {
|
||||
|
||||
return User.aggregate(User.getUsersNationalityQuery(idapp)).then(ris => {
|
||||
// console.table(ris);
|
||||
return JSON.stringify(ris);
|
||||
return ris;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1875,7 +1876,7 @@ UserSchema.statics.UsersByIdTelegram = async function(idapp, teleg_id) {
|
||||
return User.find({
|
||||
idapp, 'profile.teleg_id': teleg_id,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}).then((rec) => {
|
||||
}).lean().then((rec) => {
|
||||
return (!!rec) ? rec._doc : null;
|
||||
}).catch((e) => {
|
||||
console.error('UserExistByIdTelegram', e);
|
||||
@@ -1891,7 +1892,7 @@ UserSchema.statics.setPicProfile = async function(idapp, username, imgpic) {
|
||||
|
||||
return User.findOneAndUpdate({
|
||||
idapp, username,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
}, {$set: fields_to_update}, {new: false}).lean().then((record) => {
|
||||
return !!record;
|
||||
});
|
||||
|
||||
@@ -1903,7 +1904,7 @@ UserSchema.statics.TelegIdByUsername = async function(idapp, username) {
|
||||
return User.findOne({
|
||||
idapp, username,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
}, {'profile.teleg_id': 1}).then((rec) => {
|
||||
}, {'profile.teleg_id': 1}).lean().then((rec) => {
|
||||
return (!!rec) ? rec.profile.teleg_id : null;
|
||||
}).catch((e) => {
|
||||
console.error('TelegIdByUsername', e);
|
||||
@@ -1914,7 +1915,7 @@ 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) => {
|
||||
}, {'notask_verif': 1}).lean().then((rec) => {
|
||||
return (!!rec && rec.notask_verif) ? true: false;
|
||||
}).catch((e) => {
|
||||
console.error('notAsk_VerifByUsername', e);
|
||||
@@ -1932,7 +1933,7 @@ UserSchema.statics.SetTelegramCheckCode = async function(
|
||||
|
||||
return User.findOneAndUpdate({
|
||||
_id: id,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
}, {$set: fields_to_update}, {new: false}).lean().then((record) => {
|
||||
return !!record;
|
||||
});
|
||||
|
||||
@@ -1966,7 +1967,7 @@ UserSchema.statics.SetTelegramIdSuccess = async function(idapp, id, teleg_id) {
|
||||
return User.findOneAndUpdate({
|
||||
idapp,
|
||||
_id: id,
|
||||
}, {$set: fields_to_update}, {new: false}).then((record) => {
|
||||
}, {$set: fields_to_update}, {new: false}).lean().then((record) => {
|
||||
return record;
|
||||
});
|
||||
|
||||
@@ -2690,8 +2691,8 @@ UserSchema.statics.checkUser = async function(idapp, username) {
|
||||
notask_verif: 1,
|
||||
'profile.teleg_id': 1,
|
||||
'profile.teleg_checkcode': 1,
|
||||
}).then((rec) => {
|
||||
return JSON.stringify(rec);
|
||||
}).lean().then((rec) => {
|
||||
return rec;
|
||||
});
|
||||
|
||||
};
|
||||
@@ -2720,7 +2721,18 @@ UserSchema.statics.calculateStat = async function(idapp, username) {
|
||||
|
||||
const numGroups = await MyGroup.countDocuments({idapp});
|
||||
|
||||
return {numMySkills, numMyGoods, numMyBachecas, numUsersReg, numGroups};
|
||||
let numByTab = {}
|
||||
|
||||
const globalTables = require('../tools/globalTables');
|
||||
|
||||
for (let table of shared_consts.TABLES_VISU_STAT_IN_HOME) {
|
||||
let mytable = globalTables.getTableByTableName(table);
|
||||
if (mytable) {
|
||||
numByTab[table] = await mytable.countDocuments({idapp});
|
||||
}
|
||||
}
|
||||
|
||||
return {numByTab, numUsersReg};
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
@@ -2752,7 +2764,7 @@ UserSchema.statics.findAllDistinctNationality = async function(idapp) {
|
||||
|
||||
return User.aggregate(User.getDistinctNationalityQuery(idapp)).then(ris => {
|
||||
// console.table(ris);
|
||||
return JSON.stringify(ris);
|
||||
return ris;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2863,7 +2875,7 @@ UserSchema.statics.calcRegDaily = async function(idapp) {
|
||||
|
||||
return User.aggregate(User.getUsersRegDaily(idapp, 30)).then(ris => {
|
||||
// console.table(ris);
|
||||
return JSON.stringify(ris);
|
||||
return ris;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -2872,7 +2884,7 @@ UserSchema.statics.calcRegWeekly = async function(idapp) {
|
||||
|
||||
return User.aggregate(User.getUsersRegWeekly(idapp, 20 * 7)).then(ris => {
|
||||
// console.table(ris);
|
||||
return JSON.stringify(ris.slice(0, -1));
|
||||
return ris.slice(0, -1);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3160,9 +3172,9 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
$or: [
|
||||
{deleted: {$exists: false}},
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
}, {username: 1});
|
||||
}, {username: 1}).lean();
|
||||
|
||||
recUser._doc.profile.asked_friends = listSentMyRequestFriends
|
||||
recUser.profile.asked_friends = listSentMyRequestFriends
|
||||
? listSentMyRequestFriends
|
||||
: [];
|
||||
|
||||
@@ -3176,7 +3188,7 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
}, MyGroup.getWhatToShow_Unknown());
|
||||
|
||||
recUser._doc.profile.asked_groups = listSentMyRequestGroups
|
||||
recUser.profile.asked_groups = listSentMyRequestGroups
|
||||
? listSentMyRequestGroups
|
||||
: [];
|
||||
|
||||
@@ -3190,7 +3202,7 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
});
|
||||
|
||||
recUser._doc.profile.manage_mygroups = listManageGroups
|
||||
recUser.profile.manage_mygroups = listManageGroups
|
||||
? listManageGroups
|
||||
: [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user