Backend support
This commit is contained in:
@ -63,4 +63,20 @@ Team.prototype.removeAdmin = async function(user: User) {
|
||||
}
|
||||
};
|
||||
|
||||
Team.prototype.suspendUser = async function(user: User, admin: User) {
|
||||
if (user.id === admin.id)
|
||||
throw new Error('Unable to suspend the current user');
|
||||
return user.update({
|
||||
suspendedById: admin.id,
|
||||
suspendedAt: new Date(),
|
||||
});
|
||||
};
|
||||
|
||||
Team.prototype.activateUser = async function(user: User, admin: User) {
|
||||
return user.update({
|
||||
suspendedById: null,
|
||||
suspendedAt: null,
|
||||
});
|
||||
};
|
||||
|
||||
export default Team;
|
||||
|
Reference in New Issue
Block a user