++ su "Friends" la ricerca per username Telegram e nome e cognome

This commit is contained in:
Surya Paolo
2022-12-15 21:57:38 +01:00
parent 8c7649d3bd
commit 54ffaa3fa5
3 changed files with 118 additions and 100 deletions

View File

@@ -546,7 +546,12 @@ CircuitSchema.statics.getUsersSingleCircuit = async function(idapp, username, ci
{$unwind: '$circuit'},
*/
{
$project: {username: 1, profile: 1, idapp: 1 /*, 'circuit.name': 1, 'circuit._id': 1*/},
$project: {
username: 1,
name: 1,
surname: 1,
profile: 1, idapp: 1 /*, 'circuit.name': 1, 'circuit._id': 1*/
},
},
{

View File

@@ -3133,11 +3133,22 @@ UserSchema.statics.getFieldsForSearch = function () {
};
UserSchema.statics.getFieldsForSearchUserFriend = function () {
return [{ field: 'username', type: tools.FieldType.exact }];
return [
{ field: 'username', type: tools.FieldType.exact },
{ field: 'profile.username_telegram', type: tools.FieldType.string },
{ field: 'name', type: tools.FieldType.string },
{ field: 'surname', type: tools.FieldType.string },
];
};
UserSchema.statics.getFieldsForSearchUserFriend_AllWords = function () {
return [{ field: 'username', type: tools.FieldType.string }];
return [
{ field: 'username', type: tools.FieldType.string },
{ field: 'profile.username_telegram', type: tools.FieldType.string },
{ field: 'name', type: tools.FieldType.string },
{ field: 'surname', type: tools.FieldType.string },
];
};
UserSchema.statics.executeQueryTable = function (idapp, params) {

View File

@@ -614,6 +614,8 @@ router.post('/getexp', authenticate, (req, res) => {
},
{
username: 1,
name: 1,
surname: 1,
email: 1,
'reported': 1,
date_report: 1,