Group Page corrected

This commit is contained in:
paoloar77
2022-08-09 17:32:06 +02:00
parent fc8e8d8034
commit 680b353535
8 changed files with 96 additions and 15 deletions

View File

@@ -190,6 +190,29 @@ MyGroupSchema.statics.refuseReqGroup = async function(idapp, username, groupname
};
// Aggiungi agli Admin del Gruppo
MyGroupSchema.statics.addToAdminOfMyGroup = async function(idapp, username, groupnameDest) {
return MyGroup.updateOne({idapp, groupname: groupnameDest},
{
$push:
{
admins: {
username,
date: new Date(),
},
},
});
};
// Rimuovi dagli Admin del Gruppo
MyGroupSchema.statics.removeAdminOfMyGroup = async function(idapp, username, groupnameDest) {
return MyGroup.updateOne({idapp, groupname: groupnameDest},
{$pull: {admins: {username: {$in: [username]}}}});
};
MyGroupSchema.statics.getWhatToShow = function(idapp, username) {
// FOR ME, PERMIT ALL
return {
@@ -209,6 +232,8 @@ MyGroupSchema.statics.getWhatToShow = function(idapp, username) {
blocked: 1,
req_users: 1,
refused_users: 1,
createdBy: 1,
date_created: 1,
};
};