Mostrare il Bene, Servizio, solo ai Propri Gruppi.
Nella pagina profilo, i "Gruppi" personali non si vedevano !
This commit is contained in:
@@ -14,7 +14,7 @@ mongoose.plugin(schema => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const CircuitSchema = new Schema({
|
const CircuitSchema = new Schema({
|
||||||
_id: {
|
Num: {
|
||||||
type: Number,
|
type: Number,
|
||||||
unique: true,
|
unique: true,
|
||||||
},
|
},
|
||||||
@@ -116,15 +116,15 @@ CircuitSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
|
|
||||||
CircuitSchema.pre('save', async function(next) {
|
CircuitSchema.pre('save', async function(next) {
|
||||||
if (this.isNew) {
|
if (this.isNew) {
|
||||||
const myrec = await Circuit.findOne().limit(1).sort({_id: -1});
|
const myrec = await Circuit.findOne().limit(1).sort({Num: -1});
|
||||||
if (!!myrec) {
|
if (!!myrec) {
|
||||||
if (myrec._doc._id === 0)
|
if (myrec._doc.Num === 0)
|
||||||
this._id = 1;
|
this.Num = 1;
|
||||||
else
|
else
|
||||||
this._id = myrec._doc._id + 1;
|
this.Num = myrec._doc.Num + 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this._id = 1;
|
this.Num = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ MyBachecaSchema.statics.getFieldsLastForSearch = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MyBachecaSchema.statics.executeQueryTable = function(idapp, params) {
|
MyBachecaSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
params.fieldsearch_last = this.getFieldsLastForSearch();
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
@@ -154,6 +154,7 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
photos: 1,
|
photos: 1,
|
||||||
@@ -168,6 +169,7 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -175,7 +177,7 @@ MyBachecaSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
params = {...params, ...otherparams};
|
params = {...params, ...otherparams};
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
||||||
@@ -243,6 +245,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -259,6 +262,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -297,6 +301,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -313,6 +318,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -351,6 +357,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -367,6 +374,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -405,6 +413,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -421,6 +430,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -459,6 +469,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
dateTimeStart: 1,
|
dateTimeStart: 1,
|
||||||
dateTimeEnd: 1,
|
dateTimeEnd: 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -475,6 +486,7 @@ MyBachecaSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -264,9 +264,9 @@ MyEventSchema.statics.getFieldsForSearch = function() {
|
|||||||
{field: 'details', type: tools.FieldType.string}];
|
{field: 'details', type: tools.FieldType.string}];
|
||||||
};
|
};
|
||||||
|
|
||||||
MyEventSchema.statics.executeQueryTable = function(idapp, params) {
|
MyEventSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (tools.INITDB_FIRSTIME) {
|
if (tools.INITDB_FIRSTIME) {
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ const MyGoodSchema = new Schema({
|
|||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
}],
|
}],
|
||||||
|
pub_to_share: {
|
||||||
|
type: Number, // PUB_TO_SHARE_ALL, PUB_TO_SHARE_ONLY_GROUPS_FOLLOW
|
||||||
|
},
|
||||||
numLevel: {
|
numLevel: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
@@ -132,7 +135,7 @@ MyGoodSchema.statics.getFieldsLastForSearch = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
MyGoodSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
params.fieldsearch_last = this.getFieldsLastForSearch();
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
@@ -150,6 +153,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
idStatusGood: 1,
|
idStatusGood: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -165,6 +169,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -172,7 +177,7 @@ MyGoodSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
params = {...params, ...otherparams};
|
params = {...params, ...otherparams};
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
||||||
@@ -238,6 +243,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -255,6 +261,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -291,6 +298,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -308,6 +316,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -344,6 +353,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -361,6 +371,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -397,6 +408,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -414,6 +426,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -450,6 +463,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'idStatusGood': 1,
|
'idStatusGood': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
otherfilters: 1,
|
otherfilters: 1,
|
||||||
@@ -467,6 +481,7 @@ MyGoodSchema.statics.getMyRecById = function(idapp, idGood) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ MyGroupSchema.statics.getFieldsForSearch = function() {
|
|||||||
return [{field: 'descr', type: tools.FieldType.string}];
|
return [{field: 'descr', type: tools.FieldType.string}];
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
MyGroupSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
|
|
||||||
const { User } = require('./user');
|
const { User } = require('./user');
|
||||||
@@ -119,7 +119,7 @@ MyGroupSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyGroupSchema.pre('save', async function(next) {
|
MyGroupSchema.pre('save', async function(next) {
|
||||||
@@ -149,6 +149,18 @@ MyGroupSchema.statics.findAllIdApp = async function(idapp) {
|
|||||||
return await MyGroup.find(myfind);
|
return await MyGroup.find(myfind);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MyGroupSchema.statics.findAllGroups = async function(idapp) {
|
||||||
|
|
||||||
|
const whatToShow = this.getWhatToShow(idapp, '');
|
||||||
|
|
||||||
|
return await MyGroup.find({
|
||||||
|
idapp,
|
||||||
|
$or: [
|
||||||
|
{deleted: {$exists: false}},
|
||||||
|
{deleted: {$exists: true, $eq: false}}],
|
||||||
|
}, whatToShow);
|
||||||
|
};
|
||||||
|
|
||||||
// Rimuovo la Richiesta del Gruppo
|
// Rimuovo la Richiesta del Gruppo
|
||||||
MyGroupSchema.statics.removeReqGroup = async function(idapp, username, groupnameDest) {
|
MyGroupSchema.statics.removeReqGroup = async function(idapp, username, groupnameDest) {
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ const MyHospSchema = new Schema({
|
|||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
}],
|
}],
|
||||||
|
pub_to_share: {
|
||||||
|
type: Number, // PUB_TO_SHARE_ALL, PUB_TO_SHARE_ONLY_GROUPS_FOLLOW
|
||||||
|
},
|
||||||
descr: {
|
descr: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
@@ -134,7 +137,7 @@ MyHospSchema.statics.getFieldsLastForSearch = function() {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
MyHospSchema.statics.executeQueryTable = function(idapp, params) {
|
MyHospSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
params.fieldsearch_last = this.getFieldsLastForSearch();
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
@@ -154,6 +157,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -165,6 +169,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -172,7 +177,7 @@ MyHospSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
params = {...params, ...otherparams};
|
params = {...params, ...otherparams};
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
||||||
@@ -238,6 +243,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -251,6 +257,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -287,6 +294,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -300,6 +308,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -336,6 +345,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -349,6 +359,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -385,6 +396,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -398,6 +410,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -434,6 +447,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
photos: 1,
|
photos: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
note: 1,
|
note: 1,
|
||||||
website: 1,
|
website: 1,
|
||||||
link_maplocation: 1,
|
link_maplocation: 1,
|
||||||
@@ -447,6 +461,7 @@ MyHospSchema.statics.getMyRecById = function(idapp, id) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ MyPageSchema.statics.getFieldsForSearch = function () {
|
|||||||
{ field: 'content', type: tools.FieldType.string }]
|
{ field: 'content', type: tools.FieldType.string }]
|
||||||
};
|
};
|
||||||
|
|
||||||
MyPageSchema.statics.executeQueryTable = function (idapp, params) {
|
MyPageSchema.statics.executeQueryTable = function (idapp, params, user) {
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MyPageSchema.statics.findAllIdApp = async function (idapp) {
|
MyPageSchema.statics.findAllIdApp = async function (idapp) {
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ const MySkillSchema = new Schema({
|
|||||||
{
|
{
|
||||||
type: Number,
|
type: Number,
|
||||||
}],
|
}],
|
||||||
|
pub_to_share: {
|
||||||
|
type: Number, // PUB_TO_SHARE_ALL, PUB_TO_SHARE_ONLY_GROUPS_FOLLOW
|
||||||
|
},
|
||||||
numLevel: {
|
numLevel: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
@@ -134,8 +137,7 @@ MySkillSchema.statics.getFieldsLastForSearch = function() {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MySkillSchema.statics.executeQueryTable = function(idapp, params, user) {
|
||||||
MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
|
||||||
params.fieldsearch = this.getFieldsForSearch();
|
params.fieldsearch = this.getFieldsForSearch();
|
||||||
params.fieldsearch_last = this.getFieldsLastForSearch();
|
params.fieldsearch_last = this.getFieldsLastForSearch();
|
||||||
|
|
||||||
@@ -153,6 +155,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
idStatusSkill: 1,
|
idStatusSkill: 1,
|
||||||
idContribType: 1,
|
idContribType: 1,
|
||||||
idCity: 1,
|
idCity: 1,
|
||||||
|
pub_to_share: 1,
|
||||||
numLevel: 1,
|
numLevel: 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
photos: 1,
|
photos: 1,
|
||||||
@@ -167,6 +170,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
name: 1,
|
name: 1,
|
||||||
surname: 1,
|
surname: 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -174,7 +178,7 @@ MySkillSchema.statics.executeQueryTable = function(idapp, params) {
|
|||||||
|
|
||||||
params = {...params, ...otherparams};
|
params = {...params, ...otherparams};
|
||||||
|
|
||||||
return tools.executeQueryTable(this, idapp, params);
|
return tools.executeQueryTable(this, idapp, params, user);
|
||||||
};
|
};
|
||||||
|
|
||||||
MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
||||||
@@ -240,6 +244,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -256,6 +261,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -292,6 +298,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -308,6 +315,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -344,6 +352,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -360,6 +369,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -398,6 +408,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -414,6 +425,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -450,6 +462,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'idStatusSkill': 1,
|
'idStatusSkill': 1,
|
||||||
'idContribType': 1,
|
'idContribType': 1,
|
||||||
'idCity': 1,
|
'idCity': 1,
|
||||||
|
pub_to_share: 1,
|
||||||
'numLevel': 1,
|
'numLevel': 1,
|
||||||
adType: 1,
|
adType: 1,
|
||||||
'photos': 1,
|
'photos': 1,
|
||||||
@@ -466,6 +479,7 @@ MySkillSchema.statics.getMyRecById = function(idapp, idSkill) {
|
|||||||
'comune': 1,
|
'comune': 1,
|
||||||
'mycities': 1,
|
'mycities': 1,
|
||||||
'profile.img': 1,
|
'profile.img': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -483,7 +497,6 @@ MySkillSchema.statics.getCompleteRecord = function(idapp, id) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const MySkill = mongoose.model('MySkill', MySkillSchema);
|
const MySkill = mongoose.model('MySkill', MySkillSchema);
|
||||||
|
|
||||||
module.exports = {MySkill};
|
module.exports = {MySkill};
|
||||||
|
|||||||
@@ -1345,6 +1345,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
|||||||
verified_email: 1,
|
verified_email: 1,
|
||||||
verified_by_aportador: 1,
|
verified_by_aportador: 1,
|
||||||
'profile.nationality': 1,
|
'profile.nationality': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
'profile.biografia': 1,
|
'profile.biografia': 1,
|
||||||
'profile.teleg_id': 1,
|
'profile.teleg_id': 1,
|
||||||
@@ -1378,6 +1379,7 @@ UserSchema.statics.getUserProfileByUsername = async function(
|
|||||||
verified_by_aportador: 1,
|
verified_by_aportador: 1,
|
||||||
notask_verif: 1,
|
notask_verif: 1,
|
||||||
'profile.nationality': 1,
|
'profile.nationality': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
'profile.biografia': 1,
|
'profile.biografia': 1,
|
||||||
'profile.teleg_id': 1,
|
'profile.teleg_id': 1,
|
||||||
@@ -1794,6 +1796,7 @@ function getWhatToShow(idapp, username) {
|
|||||||
verified_by_aportador: 1,
|
verified_by_aportador: 1,
|
||||||
notask_verif: 1,
|
notask_verif: 1,
|
||||||
'profile.nationality': 1,
|
'profile.nationality': 1,
|
||||||
|
"profile.mygroups": 1,
|
||||||
'profile.qualifica': 1,
|
'profile.qualifica': 1,
|
||||||
'profile.biografia': 1,
|
'profile.biografia': 1,
|
||||||
'profile.username_telegram': 1,
|
'profile.username_telegram': 1,
|
||||||
|
|||||||
@@ -1073,6 +1073,7 @@ function load(req, res, version) {
|
|||||||
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
let sectorgoods = SectorGood.findAllIdApp(idapp);
|
||||||
let catgrps = CatGrp.findAllIdApp(idapp);
|
let catgrps = CatGrp.findAllIdApp(idapp);
|
||||||
let site = Site.findAllIdApp(idapp);
|
let site = Site.findAllIdApp(idapp);
|
||||||
|
let mygroups = MyGroup.findAllGroups(idapp);
|
||||||
// let cities = City.findAllIdApp(idapp);
|
// let cities = City.findAllIdApp(idapp);
|
||||||
let provinces = Province.findAllIdApp(idapp);
|
let provinces = Province.findAllIdApp(idapp);
|
||||||
let cart = null;
|
let cart = null;
|
||||||
@@ -1138,6 +1139,7 @@ function load(req, res, version) {
|
|||||||
sectorgoods,
|
sectorgoods,
|
||||||
goods,
|
goods,
|
||||||
site,
|
site,
|
||||||
|
mygroups,
|
||||||
]).then((arrdata) => {
|
]).then((arrdata) => {
|
||||||
// console.table(arrdata);
|
// console.table(arrdata);
|
||||||
let myuser = req.user;
|
let myuser = req.user;
|
||||||
@@ -1216,6 +1218,7 @@ function load(req, res, version) {
|
|||||||
sectorgoods: arrdata[33],
|
sectorgoods: arrdata[33],
|
||||||
goods: arrdata[34],
|
goods: arrdata[34],
|
||||||
site: arrdata[35],
|
site: arrdata[35],
|
||||||
|
mygroups: arrdata[36],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ async function sendNotif(res, idapp, user, recmsg) {
|
|||||||
|
|
||||||
// Read from the operator table first
|
// Read from the operator table first
|
||||||
let emaildest = await Operator.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
let emaildest = await Operator.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
||||||
if (emaildest === '')
|
if (!emaildest)
|
||||||
emaildest = await User.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
emaildest = await User.getEmailByUsername(recmsg.dest.idapp, recmsg.dest.username);
|
||||||
|
|
||||||
console.log('emaildest', emaildest);
|
console.log('emaildest', emaildest);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 561 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB |
@@ -235,7 +235,6 @@ router.post('/', async (req, res) => {
|
|||||||
user.aportador_solidario = await User.getRealUsernameByUsername(user.idapp, user.aportador_solidario);
|
user.aportador_solidario = await User.getRealUsernameByUsername(user.idapp, user.aportador_solidario);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
if (!id_aportador && tools.getAskToVerifyReg(body.idapp)) {
|
||||||
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
// Si sta tentando di registrare una persona sotto che non corrisponde!
|
||||||
let msg = 'Il link di registrazione non sembra risultare valido.<br>invitante: ' +
|
let msg = 'Il link di registrazione non sembra risultare valido.<br>invitante: ' +
|
||||||
@@ -383,6 +382,7 @@ router.post('/profile', authenticate, (req, res) => {
|
|||||||
|
|
||||||
//++Todo: controlla che tipo di dati ha il permesso di leggere
|
//++Todo: controlla che tipo di dati ha il permesso di leggere
|
||||||
|
|
||||||
|
try {
|
||||||
return User.getUserProfileByUsername(idapp, username, req.user.username,
|
return User.getUserProfileByUsername(idapp, username, req.user.username,
|
||||||
false, req.user.perm).
|
false, req.user.perm).
|
||||||
then((ris) => {
|
then((ris) => {
|
||||||
@@ -396,6 +396,10 @@ router.post('/profile', authenticate, (req, res) => {
|
|||||||
tools.mylog('ERRORE IN Profile: ' + e.message);
|
tools.mylog('ERRORE IN Profile: ' + e.message);
|
||||||
res.status(400).send();
|
res.status(400).send();
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
tools.mylogserr('Error profile: ', e);
|
||||||
|
res.status(400).send();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -892,7 +892,7 @@ module.exports = {
|
|||||||
|
|
||||||
const idtelegram = await User.TelegIdById(idapp, userId);
|
const idtelegram = await User.TelegIdById(idapp, userId);
|
||||||
|
|
||||||
const msgteleg = objmsg.descr + (msgextrateleg ? '\n' + msgextrateleg : '')
|
const msgteleg = objmsg.descr + (msgextrateleg ? '\n' + msgextrateleg : '');
|
||||||
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram, msgteleg);
|
await telegrambot.sendMsgTelegramByIdTelegram(idapp, idtelegram, msgteleg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -950,7 +950,8 @@ module.exports = {
|
|||||||
objmsg.tag = 'reqgroups';
|
objmsg.tag = 'reqgroups';
|
||||||
|
|
||||||
sendnotif = false; // non lo rimandare 2 volte !
|
sendnotif = false; // non lo rimandare 2 volte !
|
||||||
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_GRUPPO, myuser, singleadmin.username, groupname, group._id);
|
telegrambot.askConfirmationUser(idapp, shared_consts.CallFunz.RICHIESTA_GRUPPO, myuser, singleadmin.username, groupname,
|
||||||
|
group._id);
|
||||||
|
|
||||||
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
|
} else if (cmd === shared_consts.GROUPSCMD.BLOCK_USER) {
|
||||||
objmsg.descr = printf(this.get__('RICHIESTA_BLOCCO_GRUPPO', lang),
|
objmsg.descr = printf(this.get__('RICHIESTA_BLOCCO_GRUPPO', lang),
|
||||||
@@ -1366,7 +1367,7 @@ module.exports = {
|
|||||||
return query;
|
return query;
|
||||||
},
|
},
|
||||||
|
|
||||||
getQueryTable: function(idapp, params) {
|
getQueryTable: function(idapp, params, user) {
|
||||||
|
|
||||||
if (typeof params.startRow !== 'number') {
|
if (typeof params.startRow !== 'number') {
|
||||||
throw new Error('startRow must be number');
|
throw new Error('startRow must be number');
|
||||||
@@ -1515,6 +1516,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.filtercustom) {
|
if (params.filtercustom) {
|
||||||
|
let condition = {};
|
||||||
for (const myfilter of params.filtercustom) {
|
for (const myfilter of params.filtercustom) {
|
||||||
if (myfilter['userId']) {
|
if (myfilter['userId']) {
|
||||||
myfilter['userId'] = ObjectID(myfilter['userId']);
|
myfilter['userId'] = ObjectID(myfilter['userId']);
|
||||||
@@ -1524,13 +1526,15 @@ module.exports = {
|
|||||||
} else if (myfilter['dateTimeStart']) {
|
} else if (myfilter['dateTimeStart']) {
|
||||||
const gte = myfilter['dateTimeStart'].$gte;
|
const gte = myfilter['dateTimeStart'].$gte;
|
||||||
const lte = myfilter['dateTimeStart'].$lte;
|
const lte = myfilter['dateTimeStart'].$lte;
|
||||||
let condition = {
|
condition = {
|
||||||
dateTimeStart: {
|
dateTimeStart: {
|
||||||
$gte: new Date(gte),
|
$gte: new Date(gte),
|
||||||
$lte: new Date(lte),
|
$lte: new Date(lte),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
filtriadded.push(condition);
|
filtriadded.push(condition);
|
||||||
|
} else if (myfilter.hasOwnProperty('pub_to_share')) {
|
||||||
|
// non aggiungere niente
|
||||||
} else {
|
} else {
|
||||||
filtriadded.push(myfilter);
|
filtriadded.push(myfilter);
|
||||||
}
|
}
|
||||||
@@ -1541,7 +1545,7 @@ module.exports = {
|
|||||||
for (let ind = 0; ind < params.filter_gte.length; ind++) {
|
for (let ind = 0; ind < params.filter_gte.length; ind++) {
|
||||||
for (const [key, value] of Object.entries(params.filter_gte[ind])) {
|
for (const [key, value] of Object.entries(params.filter_gte[ind])) {
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
let condition = {}
|
let condition = {};
|
||||||
condition[key] = {$gte: value};
|
condition[key] = {$gte: value};
|
||||||
filtriadded.push(condition);
|
filtriadded.push(condition);
|
||||||
}
|
}
|
||||||
@@ -1671,6 +1675,38 @@ module.exports = {
|
|||||||
query.push({$match: {$and: params.filtersearch2}});
|
query.push({$match: {$and: params.filtersearch2}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.filtercustom) {
|
||||||
|
let condition = {};
|
||||||
|
for (const myfilter of params.filtercustom) {
|
||||||
|
|
||||||
|
if (myfilter['pub_to_share'] === shared_consts.PUBTOSHARE.ONLY_GROUPS_FOLLOW) {
|
||||||
|
|
||||||
|
let arraygroups = [];
|
||||||
|
|
||||||
|
if (user && user.profile.mygroups) {
|
||||||
|
arraygroups = user.profile.mygroups.map(rec => rec.groupname);
|
||||||
|
}
|
||||||
|
// prendere i gruppi dell'utente
|
||||||
|
|
||||||
|
// Cerca tra i gruppi di ogni record, se combaciano almeno 1
|
||||||
|
condition = {
|
||||||
|
'profile.mygroups':
|
||||||
|
{
|
||||||
|
$elemMatch: {
|
||||||
|
groupname: {$in: arraygroups},
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
query.push({$match: {$and: [condition]}});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (params.filtersearch3or) {
|
if (params.filtersearch3or) {
|
||||||
if (params.filtersearch3or.length > 0) {
|
if (params.filtersearch3or.length > 0) {
|
||||||
query.push({$match: {$or: params.filtersearch3or}});
|
query.push({$match: {$or: params.filtersearch3or}});
|
||||||
@@ -1722,8 +1758,8 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async executeQueryTable(mythistable, idapp, params) {
|
async executeQueryTable(mythistable, idapp, params, user) {
|
||||||
let query = this.getQueryTable(idapp, params);
|
let query = this.getQueryTable(idapp, params, user);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// console.log('query', query);
|
// console.log('query', query);
|
||||||
@@ -2792,15 +2828,15 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getlinkRequestNewPassword: function(idapp, email, tokenforgot) {
|
getlinkRequestNewPassword: function(idapp, email, tokenforgot) {
|
||||||
const strlinkreg = this.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD + `?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
const strlinkreg = this.getHostByIdApp(idapp) + process.env.LINK_UPDATE_PASSWORD +
|
||||||
|
`?idapp=${idapp}&email=${email}&tokenforgot=${tokenforgot}`;
|
||||||
return strlinkreg;
|
return strlinkreg;
|
||||||
},
|
},
|
||||||
|
|
||||||
execScript: function(idapp, msg, script, testo) {
|
execScript: function(idapp, msg, script, testo) {
|
||||||
const { exec } = require("child_process");
|
const {exec} = require('child_process');
|
||||||
const telegrambot = require('../telegram/telegrambot');
|
const telegrambot = require('../telegram/telegrambot');
|
||||||
|
|
||||||
|
|
||||||
const idchat = msg.chat.id;
|
const idchat = msg.chat.id;
|
||||||
|
|
||||||
console.log(testo + ' (' + script + ')');
|
console.log(testo + ' (' + script + ')');
|
||||||
@@ -2821,6 +2857,6 @@ module.exports = {
|
|||||||
// console.log(` ... stdout: ${stdout}`);
|
// console.log(` ... stdout: ${stdout}`);
|
||||||
telegrambot.local_sendMsgTelegramByIdTelegram(idapp, idchat, stdout);
|
telegrambot.local_sendMsgTelegramByIdTelegram(idapp, idchat, stdout);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ module.exports = {
|
|||||||
REPORT_FILT_RESP: 1,
|
REPORT_FILT_RESP: 1,
|
||||||
REPORT_FILT_ATTIVITA: 2,
|
REPORT_FILT_ATTIVITA: 2,
|
||||||
|
|
||||||
|
PUBTOSHARE: {
|
||||||
|
ALL: 0,
|
||||||
|
ONLY_GROUPS_FOLLOW: 1,
|
||||||
|
},
|
||||||
|
|
||||||
TAB_COUNTRY: 'countries',
|
TAB_COUNTRY: 'countries',
|
||||||
TAB_PHONES: 'phones',
|
TAB_PHONES: 'phones',
|
||||||
TAB_SETTINGS: 'settings',
|
TAB_SETTINGS: 'settings',
|
||||||
|
|||||||
Reference in New Issue
Block a user