|
@@ -66,8 +66,6 @@ class UserGroupRelation {
|
|
|
*/
|
|
*/
|
|
|
static findAllRelationForUserGroup(userGroup) {
|
|
static findAllRelationForUserGroup(userGroup) {
|
|
|
debug('findAllRelationForUserGroup is called', userGroup);
|
|
debug('findAllRelationForUserGroup is called', userGroup);
|
|
|
- var UserGroupRelation = this;
|
|
|
|
|
-
|
|
|
|
|
return this
|
|
return this
|
|
|
.find({ relatedGroup: userGroup })
|
|
.find({ relatedGroup: userGroup })
|
|
|
.populate('relatedUser')
|
|
.populate('relatedUser')
|
|
@@ -83,7 +81,6 @@ class UserGroupRelation {
|
|
|
* @memberof UserGroupRelation
|
|
* @memberof UserGroupRelation
|
|
|
*/
|
|
*/
|
|
|
static findAllRelationForUserGroups(userGroups) {
|
|
static findAllRelationForUserGroups(userGroups) {
|
|
|
-
|
|
|
|
|
return this
|
|
return this
|
|
|
.find({ relatedGroup: { $in: userGroups } })
|
|
.find({ relatedGroup: { $in: userGroups } })
|
|
|
.populate('relatedUser')
|
|
.populate('relatedUser')
|
|
@@ -99,7 +96,6 @@ class UserGroupRelation {
|
|
|
* @memberof UserGroupRelation
|
|
* @memberof UserGroupRelation
|
|
|
*/
|
|
*/
|
|
|
static findAllRelationForUser(user) {
|
|
static findAllRelationForUser(user) {
|
|
|
-
|
|
|
|
|
return this
|
|
return this
|
|
|
.find({ relatedUser: user.id })
|
|
.find({ relatedUser: user.id })
|
|
|
.populate('relatedGroup')
|
|
.populate('relatedGroup')
|
|
@@ -199,10 +195,6 @@ class UserGroupRelation {
|
|
|
.then((count) => {
|
|
.then((count) => {
|
|
|
// return true or false of the relation is exists(not count)
|
|
// return true or false of the relation is exists(not count)
|
|
|
return (0 < count);
|
|
return (0 < count);
|
|
|
- })
|
|
|
|
|
- .catch((err) => {
|
|
|
|
|
- debug('An Error occured.', err);
|
|
|
|
|
- reject(err);
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -263,10 +255,6 @@ class UserGroupRelation {
|
|
|
else {
|
|
else {
|
|
|
relationData.remove();
|
|
relationData.remove();
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- .catch((err) => {
|
|
|
|
|
- debug('Error on find a removing user-group-relation', err);
|
|
|
|
|
- reject(err);
|
|
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|