- Aggiungere numero di persone registrate, e num di competenze, e numGruppi
This commit is contained in:
@@ -58,7 +58,7 @@ module.exports.executeQueryTable = function (idapp, params) {
|
||||
module.exports.findAllIdApp = async function (idapp) {
|
||||
const myfind = { idapp };
|
||||
|
||||
return await Hours.find(myfind);
|
||||
return Hours.find(myfind);
|
||||
};
|
||||
|
||||
module.exports.correggiHours = async function (idapp) {
|
||||
|
||||
@@ -1158,10 +1158,10 @@ UserSchema.statics.isMyFriend = async function(idapp, username, myusername) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.getUserProfileByUsername = async function(idapp, username, myusername, usaSuperPower, myperm = '') {
|
||||
UserSchema.statics.getUserProfileByUsername = async function(
|
||||
idapp, username, myusername, usaSuperPower, myperm = '') {
|
||||
const User = this;
|
||||
// If is my Friend, then can show all
|
||||
|
||||
@@ -1285,11 +1285,11 @@ UserSchema.statics.getArrUsernameFromFieldByUsername = async function(
|
||||
UserSchema.statics.getUsernameReqFriendsByUsername = async function(
|
||||
idapp, username) {
|
||||
|
||||
return this.getArrUsernameFromFieldByUsername(idapp, username, 'profile', 'req_friends');
|
||||
return this.getArrUsernameFromFieldByUsername(idapp, username, 'profile',
|
||||
'req_friends');
|
||||
|
||||
};
|
||||
|
||||
|
||||
UserSchema.statics.getUsernameFriendsByUsername = async function(
|
||||
idapp, username) {
|
||||
|
||||
@@ -1301,24 +1301,28 @@ UserSchema.statics.getUsernameFriendsByUsername = async function(
|
||||
UserSchema.statics.getUsernameGroupsByUsername = async function(
|
||||
idapp, username) {
|
||||
|
||||
return this.getArrUsernameFromFieldByUsername(idapp, username, 'profile', 'groups');
|
||||
return this.getArrUsernameFromFieldByUsername(idapp, username, 'profile',
|
||||
'groups');
|
||||
|
||||
};
|
||||
|
||||
// Rimuovo l'Amicizia
|
||||
UserSchema.statics.removeFriend = async function(idapp, username, usernameDest) {
|
||||
UserSchema.statics.removeFriend = async function(
|
||||
idapp, username, usernameDest) {
|
||||
return User.updateOne({idapp, username},
|
||||
{$pull: {'profile.friends': {username: {$in: [usernameDest]}}}});
|
||||
};
|
||||
|
||||
// Rimuovo il Gruppo
|
||||
UserSchema.statics.removeFromMyGroups = async function(idapp, username, groupnameDest) {
|
||||
UserSchema.statics.removeFromMyGroups = async function(
|
||||
idapp, username, groupnameDest) {
|
||||
return User.updateOne({idapp, username},
|
||||
{$pull: {'profile.mygroups': {groupname: {$in: [groupnameDest]}}}});
|
||||
};
|
||||
|
||||
// Rimuovo la Richiesta di Amicizia
|
||||
UserSchema.statics.removeReqFriend = async function(idapp, username, usernameDest) {
|
||||
UserSchema.statics.removeReqFriend = async function(
|
||||
idapp, username, usernameDest) {
|
||||
return User.updateOne({idapp, username: username},
|
||||
{$pull: {'profile.req_friends': {username: {$in: [usernameDest]}}}});
|
||||
};
|
||||
@@ -1395,7 +1399,7 @@ UserSchema.statics.setFriendsCmd = async function(
|
||||
idapp,
|
||||
username: usernameDest,
|
||||
'profile.req_friends': {
|
||||
$elemMatch: { username: {$eq: usernameOrig}},
|
||||
$elemMatch: {username: {$eq: usernameOrig}},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1457,7 +1461,8 @@ UserSchema.statics.setFriendsCmd = async function(
|
||||
return ris;
|
||||
};
|
||||
|
||||
UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameDest, cmd, value) {
|
||||
UserSchema.statics.setGroupsCmd = async function(
|
||||
idapp, usernameOrig, groupnameDest, cmd, value) {
|
||||
|
||||
let ris = null;
|
||||
let update = {};
|
||||
@@ -1485,7 +1490,8 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
|
||||
|
||||
// Elimina la richiesta:
|
||||
update = {$pull: {req_users: {username: {$in: [usernameOrig]}}}};
|
||||
ris = await MyGroup.updateOne({idapp, groupname: groupnameDest}, update);
|
||||
ris = await MyGroup.updateOne({idapp, groupname: groupnameDest},
|
||||
update);
|
||||
} else {
|
||||
ris = false;
|
||||
}
|
||||
@@ -1499,7 +1505,7 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
|
||||
idapp,
|
||||
groupname: groupnameDest,
|
||||
'req_users': {
|
||||
$elemMatch: { username: {$eq: usernameOrig}},
|
||||
$elemMatch: {username: {$eq: usernameOrig}},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1513,7 +1519,8 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
|
||||
},
|
||||
},
|
||||
};
|
||||
ris = await MyGroup.updateOne({idapp, groupname: groupnameDest}, update);
|
||||
ris = await MyGroup.updateOne({idapp, groupname: groupnameDest},
|
||||
update);
|
||||
}
|
||||
if (ris) {
|
||||
// Invia una notifica alla persona
|
||||
@@ -1521,11 +1528,11 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
|
||||
}
|
||||
} else {
|
||||
if (foundIfAlreadyAskGroup) {
|
||||
ris = await this.removeFromMyGroups(idapp, usernameOrig, groupnameDest); // Rimuovo il Gruppo da me
|
||||
ris = await this.removeFromMyGroups(idapp, usernameOrig,
|
||||
groupnameDest); // Rimuovo il Gruppo da me
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ris) {
|
||||
ris = await MyGroup.getInfoGroupByGroupname(idapp, groupnameDest);
|
||||
}
|
||||
@@ -1835,7 +1842,8 @@ UserSchema.statics.SetTelegramIdSuccess = async function(idapp, id, teleg_id) {
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.setUsernameTelegram = async function(idapp, id, username_telegram, firstname_telegram, lastname_telegram) {
|
||||
UserSchema.statics.setUsernameTelegram = async function(
|
||||
idapp, id, username_telegram, firstname_telegram, lastname_telegram) {
|
||||
const User = this;
|
||||
|
||||
const fields_to_update = {
|
||||
@@ -1896,7 +1904,8 @@ UserSchema.statics.SetTelegramWasBlocked = async function(idapp, teleg_id) {
|
||||
|
||||
};
|
||||
|
||||
UserSchema.statics.getNameSurnameByUsername = async function(idapp, username, reale = false) {
|
||||
UserSchema.statics.getNameSurnameByUsername = async function(
|
||||
idapp, username, reale = false) {
|
||||
const User = this;
|
||||
|
||||
return User.findOne({
|
||||
@@ -1907,12 +1916,12 @@ UserSchema.statics.getNameSurnameByUsername = async function(idapp, username, re
|
||||
if (!!rec) {
|
||||
if (reale) {
|
||||
if (!rec.name)
|
||||
return ''
|
||||
return '';
|
||||
|
||||
ris = `${rec.name} ${rec.surname}`
|
||||
ris = `${rec.name} ${rec.surname}`;
|
||||
} else {
|
||||
if (rec.name) {
|
||||
ris = `${rec.name} ${rec.surname}`
|
||||
ris = `${rec.name} ${rec.surname}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2401,7 +2410,6 @@ UserSchema.statics.getUsersQualified = async function (idapp, numinvitati) {
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
// UserSchema.statics.getNumUsersQualified = async function (idapp, numinvitati) {
|
||||
//
|
||||
// arrrec = await this.getUsersQualified(idapp, numinvitati);
|
||||
@@ -2549,14 +2557,17 @@ UserSchema.statics.checkUser = async function(idapp, username) {
|
||||
UserSchema.statics.calculateStat = async function(idapp, username) {
|
||||
const User = this;
|
||||
|
||||
/*
|
||||
return calcstat = {
|
||||
numinvitati: await ListaIngresso.getnumInvitati(idapp, username),
|
||||
numinvitati_attivi: await ListaIngresso.getnumInvitatiAttivi(idapp,
|
||||
username),
|
||||
};
|
||||
const {MySkill} = require('../models/myskill');
|
||||
const {MyGroup} = require('../models/mygroup');
|
||||
|
||||
*/
|
||||
const numUsersReg = await User.count({
|
||||
idapp,
|
||||
$or: [{deleted: {$exists: false}}, {deleted: {$exists: true, $eq: false}}],
|
||||
});
|
||||
const numMySkills = await MySkill.count({idapp});
|
||||
const numGroups = await MyGroup.count({idapp});
|
||||
|
||||
return {numMySkills, numUsersReg, numGroups};
|
||||
|
||||
};
|
||||
|
||||
@@ -2717,7 +2728,6 @@ if (tools.INITDB_FIRSTIME) {
|
||||
// UserSchema.index({ surname: 1 });
|
||||
}
|
||||
|
||||
|
||||
UserSchema.statics.getUsernameByIndOrder = async function(idapp, ind_order) {
|
||||
|
||||
const myrec = await User.getSmallRecByIndOrder(idapp, ind_order);
|
||||
@@ -2996,7 +3006,9 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
}, {username: 1});
|
||||
|
||||
recUser._doc.profile.asked_friends = listSentMyRequestFriends ? listSentMyRequestFriends : [];
|
||||
recUser._doc.profile.asked_friends = listSentMyRequestFriends
|
||||
? listSentMyRequestFriends
|
||||
: [];
|
||||
|
||||
const listSentMyRequestGroups = await MyGroup.find({
|
||||
idapp,
|
||||
@@ -3008,7 +3020,9 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
}, MyGroup.getWhatToShow_Unknown());
|
||||
|
||||
recUser._doc.profile.asked_groups = listSentMyRequestGroups ? listSentMyRequestGroups : [];
|
||||
recUser._doc.profile.asked_groups = listSentMyRequestGroups
|
||||
? listSentMyRequestGroups
|
||||
: [];
|
||||
|
||||
const listManageGroups = await MyGroup.find({
|
||||
idapp,
|
||||
@@ -3020,11 +3034,11 @@ UserSchema.statics.addExtraInfo = async function(idapp, recUser) {
|
||||
{deleted: {$exists: true, $eq: false}}],
|
||||
});
|
||||
|
||||
recUser._doc.profile.manage_mygroups = listManageGroups ? listManageGroups : [];
|
||||
recUser._doc.profile.manage_mygroups = listManageGroups
|
||||
? listManageGroups
|
||||
: [];
|
||||
|
||||
|
||||
|
||||
}catch (e){
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,5 +110,6 @@ module.exports = {
|
||||
{_id: 108, prov: 'VV', descr: 'Vibo Valentia'},
|
||||
{_id: 109, prov: 'VI', descr: 'Vicenza'},
|
||||
{_id: 110, prov: 'VT', descr: 'Viterbo'},
|
||||
{_id: 111, prov: 'RSM', descr: 'Repubblica di San Marino'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -25,7 +25,6 @@ module.exports = {
|
||||
{idSkill: 2, descr: 'Crepe muri'},
|
||||
{idSkill: 2, descr: 'Demolizione e scavi'},
|
||||
{idSkill: 2, descr: 'Soppalco'},
|
||||
{idSkill: 3, descr: ''},
|
||||
{idSkill: 4, descr: 'Potatura e manutenzione giardini'},
|
||||
{idSkill: 4, descr: 'Progettazione giardini'},
|
||||
{idSkill: 5, descr: 'Antennista'},
|
||||
@@ -115,7 +114,6 @@ module.exports = {
|
||||
{idSkill: 16, descr: 'Thailandese'},
|
||||
{idSkill: 16, descr: 'Ayurvedica'},
|
||||
{idSkill: 16, descr: 'Naturale'},
|
||||
{idSkill: 17, descr: ''},
|
||||
{idSkill: 18, descr: 'Pane'},
|
||||
{idSkill: 18, descr: 'Latte Vegetale'},
|
||||
{idSkill: 18, descr: 'Frutta'},
|
||||
@@ -129,21 +127,6 @@ module.exports = {
|
||||
{idSkill: 19, descr: 'Frutta'},
|
||||
{idSkill: 19, descr: 'Farina'},
|
||||
{idSkill: 19, descr: 'Uova'},
|
||||
{idSkill: 20, descr: ''},
|
||||
{idSkill: 21, descr: ''},
|
||||
{idSkill: 22, descr: ''},
|
||||
{idSkill: 23, descr: ''},
|
||||
{idSkill: 24, descr: ''},
|
||||
{idSkill: 25, descr: ''},
|
||||
{idSkill: 17, descr: ''},
|
||||
{idSkill: 26, descr: ''},
|
||||
{idSkill: 27, descr: ''},
|
||||
{idSkill: 28, descr: ''},
|
||||
{idSkill: 29, descr: ''},
|
||||
{idSkill: 30, descr: ''},
|
||||
{idSkill: 31, descr: ''},
|
||||
{idSkill: 32, descr: ''},
|
||||
{idSkill: 18, descr: ''},
|
||||
{idSkill: 33, descr: 'Estetista'},
|
||||
{idSkill: 33, descr: 'Ginnastica in gravidanza'},
|
||||
{idSkill: 33, descr: 'Ginnastica posturale'},
|
||||
@@ -160,7 +143,6 @@ module.exports = {
|
||||
{idSkill: 34, descr: 'Feldenkrais'},
|
||||
{idSkill: 34, descr: 'Musicoterapia'},
|
||||
{idSkill: 34, descr: 'Watsu'},
|
||||
{idSkill: 35, descr: ''},
|
||||
{idSkill: 36, descr: 'Ostetrica'},
|
||||
{idSkill: 36, descr: 'Doula'},
|
||||
{idSkill: 36, descr: 'Puericultrici'},
|
||||
@@ -183,7 +165,6 @@ module.exports = {
|
||||
{idSkill: 38, descr: 'Oculista'},
|
||||
{idSkill: 38, descr: 'Ginecologo/a'},
|
||||
{idSkill: 38, descr: 'Podologo'},
|
||||
{idSkill: 39, descr: ''},
|
||||
{idSkill: 40, descr: 'OSS (Operatore Socio Sanitario)'},
|
||||
{idSkill: 41, descr: 'Fisioterapia'},
|
||||
{idSkill: 41, descr: 'Logopedia'},
|
||||
@@ -212,18 +193,10 @@ module.exports = {
|
||||
{idSkill: 46, descr: 'Dichiarazione di rispondenza impianto idrico'},
|
||||
{idSkill: 46, descr: 'Dichiarazione di rispondenza impianto termico'},
|
||||
{idSkill: 2, descr: 'Piastrellista'},
|
||||
{idSkill: 47, descr: ''},
|
||||
{idSkill: 48, descr: ''},
|
||||
{idSkill: 49, descr: ''},
|
||||
{idSkill: 50, descr: ''},
|
||||
{idSkill: 51, descr: ''},
|
||||
{idSkill: 52, descr: ''},
|
||||
{idSkill: 53, descr: ''},
|
||||
{idSkill: 54, descr: 'Impermeabilizzazione balcone'},
|
||||
{idSkill: 54, descr: 'Impermeabilizzazione muri controterra'},
|
||||
{idSkill: 54, descr: 'Impermeabilizzazione terrazzo'},
|
||||
{idSkill: 54, descr: 'Impermeabilizzazione tetto'},
|
||||
{idSkill: 55, descr: ''},
|
||||
{idSkill: 56, descr: 'antifurto casa'},
|
||||
{idSkill: 56, descr: 'aria condizionata'},
|
||||
{idSkill: 56, descr: 'Installazione ascensore'},
|
||||
@@ -263,7 +236,6 @@ module.exports = {
|
||||
{idSkill: 57, descr: 'Restauro mobili'},
|
||||
{idSkill: 57, descr: 'Restauro sedie'},
|
||||
{idSkill: 58, descr: 'Coibentazione tetto'},
|
||||
{idSkill: 59, descr: ''},
|
||||
{idSkill: 13, descr: 'Cassaforte'},
|
||||
{idSkill: 13, descr: 'Citofono senza fili'},
|
||||
{idSkill: 13, descr: 'Videocitofono citofono e campanelli'},
|
||||
@@ -282,8 +254,6 @@ module.exports = {
|
||||
{idSkill: 61, descr: 'Posa parquet laminato'},
|
||||
{idSkill: 61, descr: 'Posa pavimento pvc'},
|
||||
{idSkill: 61, descr: 'Posa piastrelle'},
|
||||
{idSkill: 62, descr: ''},
|
||||
{idSkill: 63, descr: ''},
|
||||
{idSkill: 18, descr: 'Detergenti'},
|
||||
{idSkill: 18, descr: 'Oggettistica'},
|
||||
{idSkill: 64, descr: 'Abiti su misura'},
|
||||
@@ -296,9 +266,7 @@ module.exports = {
|
||||
{idSkill: 67, descr: 'Dichiarazione dei redditi'},
|
||||
{idSkill: 68, descr: 'Legale'},
|
||||
{idSkill: 69, descr: 'Diversamente abili'},
|
||||
{idSkill: 69, descr: ''},
|
||||
{idSkill: 69, descr: 'Guardia del corpo'},
|
||||
{idSkill: 70, descr: ''},
|
||||
{idSkill: 71, descr: 'Corsi di chitarra per principianti'},
|
||||
{idSkill: 71, descr: 'Corsi di cucina'},
|
||||
{idSkill: 71, descr: 'Corsi di cucina per bambini'},
|
||||
@@ -330,7 +298,6 @@ module.exports = {
|
||||
{idSkill: 73, descr: 'Scuola Media'},
|
||||
{idSkill: 73, descr: 'Scuola Superiore'},
|
||||
{idSkill: 73, descr: 'Scuola Universitaria'},
|
||||
{idSkill: 74, descr: ''},
|
||||
{idSkill: 75, descr: 'Aiuto tesi'},
|
||||
{idSkill: 75, descr: 'Parentale e supporto all\'istruzione'},
|
||||
{idSkill: 75, descr: 'Privatista'},
|
||||
@@ -343,7 +310,6 @@ module.exports = {
|
||||
{idSkill: 75, descr: 'Lezioni di musica'},
|
||||
{idSkill: 75, descr: 'Lezioni strumenti musicali'},
|
||||
{idSkill: 76, descr: 'Trasporto Solidale'},
|
||||
{idSkill: 77, descr: ''},
|
||||
{idSkill: 78, descr: 'Addio al celibato/nubilato'},
|
||||
{idSkill: 78, descr: 'Buffet di compleanno'},
|
||||
{idSkill: 78, descr: 'Cake designer'},
|
||||
@@ -376,7 +342,6 @@ module.exports = {
|
||||
{idSkill: 81, descr: 'Autista privato'},
|
||||
{idSkill: 18, descr: 'Sapone'},
|
||||
{idSkill: 18, descr: 'Cosmesi'},
|
||||
{idSkill: 18, descr: ''},
|
||||
{idSkill: 18, descr: 'Shampoo'},
|
||||
{idSkill: 82, descr: 'Agenzia video'},
|
||||
{idSkill: 82, descr: 'Corso videomaker'},
|
||||
@@ -391,8 +356,6 @@ module.exports = {
|
||||
{idSkill: 82, descr: 'Studio registrazione audio'},
|
||||
{idSkill: 82, descr: 'Tecnico del suono'},
|
||||
{idSkill: 82, descr: 'Videomaking'},
|
||||
{idSkill: 83, descr: ''},
|
||||
{idSkill: 84, descr: ''},
|
||||
{idSkill: 29, descr: 'Book fotografico'},
|
||||
{idSkill: 29, descr: 'Corso di fotografia'},
|
||||
{idSkill: 29, descr: 'Foto e-commerce'},
|
||||
|
||||
@@ -26,21 +26,21 @@ router.post('/load', async (req, res) => {
|
||||
|
||||
let datastat = {
|
||||
num_reg: await User.getUsersRegistered(idapp),
|
||||
num_passeggeri: await 0,
|
||||
num_imbarcati: 0,
|
||||
email_non_verif: await User.getEmailNotVerified(idapp),
|
||||
// num_passeggeri: await 0,
|
||||
// num_imbarcati: 0,
|
||||
// email_non_verif: await User.getEmailNotVerified(idapp),
|
||||
num_teleg_attivo: await User.getUsersTelegramAttivo(idapp),
|
||||
num_teleg_pending: await User.getUsersTelegramPending(idapp),
|
||||
// num_qualificati: await User.getNumUsersQualified(idapp, 2),
|
||||
// num_requisiti: await User.getNumUsersQualified(idapp, 0),
|
||||
// num_modalita_pagamento: await User.getnumPaymentOk(idapp),
|
||||
num_part_zoom: await User.getUsersZoom(idapp),
|
||||
num_part_accepted: await User.getSaw_and_Accepted(idapp),
|
||||
// num_part_zoom: await User.getUsersZoom(idapp),
|
||||
// num_part_accepted: await User.getSaw_and_Accepted(idapp),
|
||||
arr_nations: await User.findAllDistinctNationality(idapp),
|
||||
numreg_untilday: await User.calcnumRegUntilDay(idapp),
|
||||
reg_daily: await User.calcRegDaily(idapp),
|
||||
imbarcati_daily: 0,
|
||||
imbarcati_weekly: 0,
|
||||
// imbarcati_daily: 0,
|
||||
// imbarcati_weekly: 0,
|
||||
reg_weekly: await User.calcRegWeekly(idapp),
|
||||
lastsreg: await User.getLastUsers(idapp),
|
||||
checkuser: await User.checkUser(idapp, username),
|
||||
|
||||
@@ -2,6 +2,7 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
const {User} = require('../models/user');
|
||||
|
||||
// const { Nave } = require('../models/nave');
|
||||
const Hours = require('../models/hours');
|
||||
//const { NavePersistente } = require('../models/navepersistente');
|
||||
@@ -865,6 +866,16 @@ async function eseguiDbOp(idapp, mydata, locale) {
|
||||
|
||||
await User.setVerifiedByAportadorToALL();
|
||||
|
||||
} else if (mydata.dbop === 'emptyDbSkill') {
|
||||
|
||||
const {Sector} = require('../models/sector');
|
||||
const {Skill} = require('../models/skill');
|
||||
const {SubSkill} = require('../models/subskill');
|
||||
|
||||
await Sector.remove({});
|
||||
await Skill.remove({});
|
||||
await SubSkill.remove({});
|
||||
|
||||
/*} else if (mydata.dbop === 'visuNave') {
|
||||
mystr = await Nave.getNavePos(idapp, parseInt(mydata.riga), parseInt(mydata.col));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user