Fare procedura per cambiare gli username in giro nelle varie tabelle

This commit is contained in:
Surya Paolo
2022-12-23 00:36:35 +01:00
parent 786843f115
commit 7e1407cbb1
8 changed files with 352 additions and 274 deletions

View File

@@ -384,14 +384,14 @@ const UserSchema = new mongoose.Schema({
_id: false,
groupname: { type: String },
date: { type: Date },
}], // username
}],
mycircuits: [
{
_id: false,
circuitname: { type: String },
date: { type: Date },
}], // username
}],
notifs: [
{
@@ -1102,7 +1102,7 @@ UserSchema.statics.isUserQualified9 = async function(idapp, username) {
UserSchema.statics.getnumPaymentOk = function (idapp) {
const User = this;
return await User.count({
return await User. countDocuments({
idapp,
$and: [
{
@@ -3299,7 +3299,7 @@ UserSchema.statics.getUsersRegistered = async function (idapp) {
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersRegisteredToday = async function (idapp) {
@@ -3314,7 +3314,7 @@ UserSchema.statics.getUsersRegisteredToday = async function (idapp) {
date_reg: { $gt: starttoday },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersOnLineToday = async function (idapp) {
@@ -3329,7 +3329,7 @@ UserSchema.statics.getUsersOnLineToday = async function (idapp) {
lasttimeonline: { $gt: starttoday },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
/*
@@ -3398,7 +3398,7 @@ UserSchema.statics.getEmailNotVerified = async function (idapp) {
verified_email: false,
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersTelegramAttivo = async function (idapp) {
@@ -3410,7 +3410,7 @@ UserSchema.statics.getUsersTelegramAttivo = async function (idapp) {
'profile.teleg_id': { $gt: 0 },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersAutorizzati = async function (idapp) {
@@ -3423,7 +3423,7 @@ UserSchema.statics.getUsersAutorizzati = async function (idapp) {
verified_by_aportador: true,
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersAutorizzare = async function (idapp) {
@@ -3436,7 +3436,7 @@ UserSchema.statics.getUsersAutorizzare = async function (idapp) {
verified_by_aportador: { $exists: false },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersTelegramPending = async function (idapp) {
@@ -3448,7 +3448,7 @@ UserSchema.statics.getUsersTelegramPending = async function (idapp) {
'profile.teleg_checkcode': { $gt: 0 },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getNumUsers = async function (idapp) {
@@ -3459,7 +3459,7 @@ UserSchema.statics.getNumUsers = async function (idapp) {
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersZoom = async function (idapp) {
@@ -3471,7 +3471,7 @@ UserSchema.statics.getUsersZoom = async function (idapp) {
'profile.saw_zoom_presentation': true,
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getUsersResidenti = async function (idapp) {
@@ -3495,7 +3495,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 await User. countDocuments(myfind);
};
UserSchema.statics.getUsersDreams = async function (idapp) {
@@ -3508,7 +3508,7 @@ UserSchema.statics.getUsersDreams = async function (idapp) {
'$expr': { '$gt': [{ '$strLenCP': '$profile.my_dream' }, 10] },
};
return await User.count(myfind);
return await User. countDocuments(myfind);
};
UserSchema.statics.getLastUsers = async function (idapp) {
@@ -4303,6 +4303,7 @@ UserSchema.statics.tooManyReqPassword = async function (idapp, email, set) {
};
UserSchema.statics.createNewSubRecord = async function (idapp, req) {
const User = this;