- aggiunto il Comune di Residenza alla REgistrazione e al Tutorial
This commit is contained in:
@@ -324,7 +324,6 @@ html(lang="it")
|
||||
|
||||
//- CTA principale
|
||||
.cta-section
|
||||
.cta-title Ammetti #{usernameInvitato} alla comunità RISO
|
||||
a.cta-button(href=linkAmmissione target="_blank")
|
||||
span.button-icon ✓
|
||||
| Sì, Confermo
|
||||
|
||||
@@ -857,4 +857,6 @@ Sab 08/11 ORE 20:24: 🤖: Da Surya Ar (SuryaSecondo):
|
||||
Dom 09/11 ORE 18:36: 🤖: Da Sùrya undefined (surya1977):
|
||||
✅ surya4 è stato Ammesso correttamente (da surya1977)!
|
||||
Mar 18/11 ORE 22:31: 🤖: Da Sùrya undefined (surya1977):
|
||||
✅ surya8 è stato Ammesso correttamente (da surya1977)!
|
||||
✅ surya8 è stato Ammesso correttamente (da surya1977)!
|
||||
Gio 27/11 ORE 00:43: 🤖: Da Sùrya undefined (surya1977):
|
||||
✅ test123 è stato Ammesso correttamente (da surya1977)!
|
||||
@@ -16,7 +16,7 @@ const { ObjectId } = require('mongodb');
|
||||
const tableModel = shared_consts.TABLES_ATTIVITAS;
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
mongoose.plugin((schema) => {
|
||||
schema.options.usePushEach = true;
|
||||
});
|
||||
|
||||
@@ -44,9 +44,9 @@ const AttivitaSchema = new Schema(
|
||||
idCity: [
|
||||
{
|
||||
type: Number,
|
||||
}],
|
||||
logo:
|
||||
{
|
||||
},
|
||||
],
|
||||
logo: {
|
||||
imagefile: {
|
||||
type: String,
|
||||
},
|
||||
@@ -68,7 +68,8 @@ const AttivitaSchema = new Schema(
|
||||
description: {
|
||||
type: String,
|
||||
},
|
||||
}],
|
||||
},
|
||||
],
|
||||
note: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -107,7 +108,7 @@ const AttivitaSchema = new Schema(
|
||||
coordinates: {
|
||||
type: [Number], // L'array dovrebbe contenere lon e lat
|
||||
required: false,
|
||||
index: '2dsphere' // Indice geospaziale [lng, lat]
|
||||
index: '2dsphere', // Indice geospaziale [lng, lat]
|
||||
},
|
||||
},
|
||||
|
||||
@@ -123,23 +124,21 @@ const AttivitaSchema = new Schema(
|
||||
whatsapp: {
|
||||
type: String,
|
||||
},
|
||||
createdBy: { // Username del creatore (proponente)
|
||||
createdBy: {
|
||||
// Username del creatore (proponente)
|
||||
type: String,
|
||||
},
|
||||
|
||||
|
||||
//**ADDFIELD_ATTIVITA
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...tools.getFieldsForAnnunci()
|
||||
}, { strict: false });
|
||||
|
||||
|
||||
...tools.getFieldsForAnnunci(),
|
||||
},
|
||||
);
|
||||
|
||||
AttivitaSchema.pre('save', async function (next) {
|
||||
if (this.isNew) {
|
||||
if (!this.date_created)
|
||||
this.date_created = new Date();
|
||||
if (!this.date_created) this.date_created = new Date();
|
||||
}
|
||||
|
||||
next();
|
||||
@@ -148,15 +147,11 @@ AttivitaSchema.pre('save', async function (next) {
|
||||
AttivitaSchema.statics.findAllIdApp = async function (idapp) {
|
||||
const Attivita = this;
|
||||
|
||||
const query = [
|
||||
{ $match: { idapp } },
|
||||
{ $sort: { descr: 1 } },
|
||||
];
|
||||
const query = [{ $match: { idapp } }, { $sort: { descr: 1 } }];
|
||||
|
||||
return await Attivita.aggregate(query).then((arrrec) => {
|
||||
return arrrec;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
AttivitaSchema.statics.getFieldsForSearch = function () {
|
||||
@@ -197,39 +192,37 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
|
||||
let query = [
|
||||
{
|
||||
'$match': {
|
||||
'_id': idSkill, idapp
|
||||
$match: {
|
||||
_id: idSkill,
|
||||
idapp,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$sort': {
|
||||
'desc': 1,
|
||||
$sort: {
|
||||
desc: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
'$addFields': {
|
||||
'myId1': {
|
||||
'$toObjectId': '$userId',
|
||||
$addFields: {
|
||||
myId1: {
|
||||
$toObjectId: '$userId',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
'from': 'users',
|
||||
'localField': 'myId1',
|
||||
'foreignField': '_id',
|
||||
'as': 'user',
|
||||
$lookup: {
|
||||
from: 'users',
|
||||
localField: 'myId1',
|
||||
foreignField: '_id',
|
||||
as: 'user',
|
||||
},
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
$mergeObjects: [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$user',
|
||||
0,
|
||||
],
|
||||
$arrayElemAt: ['$user', 0],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
@@ -240,22 +233,19 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
'from': 'skills',
|
||||
'localField': 'idSkill',
|
||||
'foreignField': '_id',
|
||||
'as': 'recSkill',
|
||||
$lookup: {
|
||||
from: 'skills',
|
||||
localField: 'idSkill',
|
||||
foreignField: '_id',
|
||||
as: 'recSkill',
|
||||
},
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
$mergeObjects: [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$recSkill',
|
||||
0,
|
||||
],
|
||||
$arrayElemAt: ['$recSkill', 0],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
@@ -266,22 +256,19 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
'from': 'sectors',
|
||||
'localField': 'idSector',
|
||||
'foreignField': '_id',
|
||||
'as': 'sector',
|
||||
$lookup: {
|
||||
from: 'sectors',
|
||||
localField: 'idSector',
|
||||
foreignField: '_id',
|
||||
as: 'sector',
|
||||
},
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
$mergeObjects: [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$sector',
|
||||
0,
|
||||
],
|
||||
$arrayElemAt: ['$sector', 0],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
@@ -292,14 +279,11 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
$mergeObjects: [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$attivita',
|
||||
0,
|
||||
],
|
||||
$arrayElemAt: ['$attivita', 0],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
@@ -310,22 +294,19 @@ AttivitaSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
$project: shared_consts.getProjectForAll({}, tableModel),
|
||||
},
|
||||
{
|
||||
'$lookup': {
|
||||
'from': 'cities',
|
||||
'localField': 'idCity',
|
||||
'foreignField': '_id',
|
||||
'as': 'mycities',
|
||||
$lookup: {
|
||||
from: 'cities',
|
||||
localField: 'idCity',
|
||||
foreignField: '_id',
|
||||
as: 'mycities',
|
||||
},
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
$replaceRoot: {
|
||||
newRoot: {
|
||||
$mergeObjects: [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$mycities',
|
||||
0,
|
||||
],
|
||||
$arrayElemAt: ['$mycities', 0],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
@@ -374,24 +355,23 @@ AttivitaSchema.statics.getProject = function (proj_add2) {
|
||||
//**ADDFIELD_ATTIVITA
|
||||
};
|
||||
|
||||
const proj_add = shared_consts.getProjectForAll(proj_add2)
|
||||
const proj_add = shared_consts.getProjectForAll(proj_add2);
|
||||
|
||||
return Object.assign({}, proj, proj_add);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
AttivitaSchema.statics.getCompleteRecord = function (idapp, id) {
|
||||
const Attivita = this;
|
||||
|
||||
return Attivita.getMyRecById(idapp, id);
|
||||
|
||||
};
|
||||
|
||||
const Attivita = mongoose.model('Attivita', AttivitaSchema);
|
||||
|
||||
Attivita.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
.then(() => {})
|
||||
.catch((err) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
module.exports = { Attivita };
|
||||
|
||||
@@ -169,6 +169,8 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
comune_solo: { $concat: ["$comune", ""] },
|
||||
prov: 1,
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -189,6 +191,8 @@ CitySchema.statics.executeQueryPickup = async function (idapp, params) {
|
||||
{
|
||||
$project: {
|
||||
comune: { $concat: ["$comune", " (", "$prov", ")"] },
|
||||
comune_solo: { $concat: ["$comune", ""] },
|
||||
prov: 1,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -103,7 +103,7 @@ const MySkillSchema = new Schema(
|
||||
},
|
||||
...Reaction.getFieldsForReactions(),
|
||||
...tools.getFieldsForAnnunci()
|
||||
}, { strict: false });
|
||||
}, { strict: true });
|
||||
|
||||
MySkillSchema.index({ 'idapp': 1 });
|
||||
|
||||
@@ -340,6 +340,7 @@ MySkillSchema.statics.getMyRecById = function (idapp, idSkill) {
|
||||
};
|
||||
|
||||
query = [...query, { ...toadd }];
|
||||
|
||||
|
||||
return MySkill.aggregate(query).then((rec) => {
|
||||
return rec ? rec[0] : null;
|
||||
|
||||
@@ -1339,6 +1339,7 @@ sendNotifSchema.statics.getNotificationRecipients = async function (myrecnotifpa
|
||||
username: 1,
|
||||
'profile.notifs': 1,
|
||||
'profile.mycircuits': 1,
|
||||
'profile.resid_str_comune': 1,
|
||||
'profile.resid_province': 1,
|
||||
'profile.resid_card': 1,
|
||||
'profile.notif_idCities': 1,
|
||||
|
||||
@@ -5752,6 +5752,7 @@ UserSchema.statics.getQueryLastUsersStretteDiMano = async function (idapp) {
|
||||
$first: {
|
||||
profile: {
|
||||
img: '$userfriend.profile.img',
|
||||
resid_str_comune: '$userfriend.profile.resid_str_comune',
|
||||
resid_province: '$userfriend.profile.resid_province',
|
||||
note: '$userfriend.profile.note',
|
||||
},
|
||||
@@ -5765,6 +5766,7 @@ UserSchema.statics.getQueryLastUsersStretteDiMano = async function (idapp) {
|
||||
$first: {
|
||||
img: '$profile.img',
|
||||
handshake: '$profile.handshake',
|
||||
resid_str_comune: '$profile.resid_str_comune',
|
||||
resid_province: '$profile.resid_province',
|
||||
note: '$profile.note',
|
||||
},
|
||||
|
||||
@@ -37,6 +37,21 @@ const Macro = require('../modules/Macro');
|
||||
class CronMod {
|
||||
constructor() {}
|
||||
|
||||
async RimuoviInteri(mytable) {
|
||||
try {
|
||||
console.log('INIZIO - RimuoviInteri ', mytable.modelName);
|
||||
|
||||
const arr = await mytable.find({ _id: { $lte: 10000 } });
|
||||
console.log(' search interi...', arr.length);
|
||||
|
||||
const ris = await mytable.deleteMany({ _id: { $lte: 10000 } });
|
||||
|
||||
console.log('FINE - RimuoviInteri ', mytable.modelName, ris);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
async eseguiDbOp(idapp, mydata, req, res) {
|
||||
let ris = await User.DbOp(idapp, mydata);
|
||||
|
||||
@@ -67,11 +82,11 @@ class CronMod {
|
||||
} else if (mydata.dbop === 'EsportaInfoProductExtra') {
|
||||
const macro = new Macro(idapp, {});
|
||||
mystr = await macro.EsportaInfoProductExtra();
|
||||
ris = { mystr };
|
||||
ris = { mystr };
|
||||
} else if (mydata.dbop === 'ImportaInfoProductExtra') {
|
||||
const macro = new Macro(idapp, {});
|
||||
mystr = await macro.ImportaInfoProductExtra();
|
||||
ris = { mystr };
|
||||
ris = { mystr };
|
||||
} else if (mydata.dbop === 'ScraperEstraiDatiAmazon-NoUpdate') {
|
||||
mystr = await AmazonBookScraper.ScraperMultipleDataAmazon(idapp, {
|
||||
update: false,
|
||||
@@ -425,6 +440,20 @@ class CronMod {
|
||||
await ConvertiDaIntAStr(MyGroup);
|
||||
|
||||
console.log('FINE - Conversioni');
|
||||
} else if (mydata.dbop === 'RemoveDatiInutiliMySkill') {
|
||||
const { MySkill } = require('../models/myskill');
|
||||
|
||||
try {
|
||||
const docs = await MySkill.find({}).lean();
|
||||
|
||||
for (const doc of docs) {
|
||||
await MySkill.replaceOne({ _id: doc._id }, doc);
|
||||
}
|
||||
ris = true;
|
||||
console.log('RIS', ris);
|
||||
} catch (e) {
|
||||
console.error('err', e);
|
||||
}
|
||||
} else if (mydata.dbop === 'Removeinteger') {
|
||||
const { MySkill } = require('../models/myskill');
|
||||
const { MyBacheca } = require('../models/mybacheca');
|
||||
@@ -434,11 +463,11 @@ class CronMod {
|
||||
|
||||
console.log('INIZIO - Rimozione');
|
||||
|
||||
await RimuoviInteri(MySkill);
|
||||
await RimuoviInteri(MyBacheca);
|
||||
await RimuoviInteri(MyHosp);
|
||||
await RimuoviInteri(MyGood);
|
||||
await RimuoviInteri(MyGroup);
|
||||
await this.RimuoviInteri(MySkill);
|
||||
await this.RimuoviInteri(MyBacheca);
|
||||
await this.RimuoviInteri(MyHosp);
|
||||
await this.RimuoviInteri(MyGood);
|
||||
await this.RimuoviInteri(MyGroup);
|
||||
|
||||
console.log('FINE - Rimozione');
|
||||
} else if (mydata.dbop === 'createAllCircuits') {
|
||||
|
||||
@@ -1092,20 +1092,6 @@ async function ConvertiDaIntAStr(mytable) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
async function RimuoviInteri(mytable) {
|
||||
try {
|
||||
console.log('INIZIO - RimuoviInteri ', mytable.modelName);
|
||||
|
||||
const arr = await mytable.find({ _id: { $lte: 10000 } });
|
||||
console.log(' search interi...', arr.length);
|
||||
|
||||
const ris = await mytable.deleteMany({ _id: { $lte: 10000 } });
|
||||
|
||||
console.log('FINE - RimuoviInteri ', mytable.modelName, ris);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
async function eseguiDbOpUser(idapp, mydata, locale, req, res) {
|
||||
let ris = await User.DbOp(idapp, mydata);
|
||||
@@ -1225,6 +1211,7 @@ router.post('/infomap', authenticate, async (req, res) => {
|
||||
aportador_solidario: 1,
|
||||
lasttimeonline: 1,
|
||||
'profile.img': 1,
|
||||
'profile.resid_str_comune': 1,
|
||||
'profile.resid_province': 1,
|
||||
lat: '$provinceInfo.lat', // Aggiunge il campo lat preso dalla provincia
|
||||
long: '$provinceInfo.long', // Aggiunge il campo long preso dalla provincia
|
||||
|
||||
@@ -36,8 +36,6 @@ const { MsgTemplate } = require('../models/msg_template');
|
||||
|
||||
const i18n = require('i18n');
|
||||
|
||||
|
||||
|
||||
let url = process.env.URL || 'https://<PUBLIC-URL>';
|
||||
|
||||
const Benvenuto = '💓💓💓 Benvenuto/a!';
|
||||
@@ -918,7 +916,6 @@ const MyTelegramBot = {
|
||||
callback_data: InlineConferma.RISPOSTA_SI + myfunc + tools.SEP + myuser.username + tools.SEP + userDest,
|
||||
},
|
||||
]);
|
||||
|
||||
}
|
||||
/*{
|
||||
text: '🚫 Rifiuta ' + myuser.username,
|
||||
@@ -4569,8 +4566,20 @@ if (true) {
|
||||
`${userDest.username}`
|
||||
);
|
||||
|
||||
let token = ''; //++SISTEMAERE QUI!
|
||||
|
||||
const dati = {
|
||||
token,
|
||||
};
|
||||
|
||||
// Invia una email alla persona che è stata ammessa
|
||||
const ris = await sendemail.sendEmail_Utente_Ammesso(user.lang, userDest, null, user.idapp, null);
|
||||
const ris = await sendemail.sendEmail_Utente_Ammesso(
|
||||
user.lang,
|
||||
userDest,
|
||||
null,
|
||||
user.idapp,
|
||||
dati,
|
||||
);
|
||||
|
||||
await local_sendMsgTelegram(user.idapp, data.username, msgOrig);
|
||||
await local_sendMsgTelegram(user.idapp, data.userDest, msgDest);
|
||||
|
||||
@@ -2734,6 +2734,8 @@ module.exports = {
|
||||
filtriadded.push({ 'profile.teleg_id_old': { $gt: 1 } });
|
||||
if (params.filterand.includes(shared_consts.FILTER_USER_PROVINCE))
|
||||
filtriadded.push({ 'profile.resid_province': { $exists: true } });
|
||||
if (params.filterand.includes(shared_consts.FILTER_USER_COMUNE))
|
||||
filtriadded.push({ 'profile.resid_str_comune': { $exists: true } });
|
||||
if (params.filterand.includes(shared_consts.FILTER_USER_SENZA_PROVINCE))
|
||||
filtriadded.push({ 'profile.resid_province': { $exists: false } });
|
||||
if (params.filterand.includes(shared_consts.FILTER_ATTIVI))
|
||||
|
||||
@@ -56,6 +56,7 @@ module.exports = {
|
||||
FILTER_SENZA_NOTE: 1073741824,
|
||||
FILTER_DA_CONTATTARE: 2147483648,
|
||||
FILTER_FACILITATORE: 4294967296,
|
||||
FILTER_USER_COMUNE: 8589934592,
|
||||
|
||||
OPTIONS_SEARCH_ONLY_FULL_WORDS: 1,
|
||||
OPTIONS_SEARCH_USER_ONLY_FULL_WORDS: 2,
|
||||
@@ -1028,6 +1029,7 @@ module.exports = {
|
||||
'profile.qualifica': 1,
|
||||
'profile.note': 1,
|
||||
'profile.da_contattare': 1,
|
||||
'profile.resid_str_comune': 1,
|
||||
'profile.resid_province': 1,
|
||||
'profile.resid_card': 1,
|
||||
'profile.username_telegram': 1,
|
||||
|
||||
Reference in New Issue
Block a user