Group Page : visibility, some info, members views.
This commit is contained in:
@@ -181,6 +181,7 @@ CitySchema.statics.executeQueryPickup = async function(idapp, params) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
CitySchema.statics.findAllIdApp = async function(idapp) {
|
||||
const myfind = {};
|
||||
|
||||
|
||||
@@ -368,6 +368,54 @@ MyGroupSchema.statics.getGroupsByUsername = async function(idapp, username, req)
|
||||
};
|
||||
};
|
||||
|
||||
MyGroupSchema.statics.extractCitiesName = async function(idapp, id) {
|
||||
|
||||
try {
|
||||
let aggr1 = [
|
||||
{
|
||||
$match: {idapp, _id: id},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'cities',
|
||||
localField: 'idCity',
|
||||
foreignField: '_id',
|
||||
as: 'mycities',
|
||||
},
|
||||
},
|
||||
{
|
||||
'$replaceRoot': {
|
||||
'newRoot': {
|
||||
'$mergeObjects': [
|
||||
{
|
||||
'$arrayElemAt': [
|
||||
'$mycities',
|
||||
0,
|
||||
],
|
||||
},
|
||||
'$$ROOT',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
$project: {
|
||||
"mycities.comune": 1,
|
||||
"mycities.prov": 1
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
ris = await this.aggregate(aggr1);
|
||||
|
||||
return ris;
|
||||
}catch (e) {
|
||||
console.error('e', e);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
|
||||
|
||||
module.exports = {MyGroup};
|
||||
|
||||
@@ -1925,6 +1925,9 @@ UserSchema.statics.setGroupsCmd = async function(idapp, usernameOrig, groupnameD
|
||||
|
||||
} else if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) {
|
||||
|
||||
// Remove if is also an Admin
|
||||
await MyGroup.removeAdminOfMyGroup(idapp, usernameOrig, groupnameDest);
|
||||
|
||||
ris = await User.removeFromMyGroups(idapp, usernameOrig, groupnameDest); // Rimuovo l'Amicizia da me
|
||||
console.log('ris', ris);
|
||||
|
||||
@@ -2059,6 +2062,9 @@ UserSchema.statics.getWhatToShow_IfFriends = async function(idapp, username) {
|
||||
'profile.sex': 1,
|
||||
'profile.born_province': 1,
|
||||
'profile.born_country': 1,
|
||||
reported: 1,
|
||||
date_report: 1,
|
||||
username_who_report: 1,
|
||||
date_reg: 1,
|
||||
groups: 1,
|
||||
friends: 1,
|
||||
|
||||
Reference in New Issue
Block a user