groups: remove unused addMember
This commit is contained in:
@@ -11,7 +11,6 @@ exports = module.exports = {
|
||||
listWithMembers,
|
||||
|
||||
getMembers,
|
||||
addMember,
|
||||
setMembers,
|
||||
removeMember,
|
||||
isMember,
|
||||
@@ -169,17 +168,6 @@ async function setMembership(userId, groupIds) {
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
async function addMember(groupId, userId) {
|
||||
assert.strictEqual(typeof groupId, 'string');
|
||||
assert.strictEqual(typeof userId, 'string');
|
||||
|
||||
const [error] = await safe(database.query('INSERT INTO groupMembers (groupId, userId) VALUES (?, ?)', [ groupId, userId ]));
|
||||
if (error && error.code === 'ER_DUP_ENTRY') throw new BoxError(BoxError.ALREADY_EXISTS, error);
|
||||
if (error && error.code === 'ER_NO_REFERENCED_ROW_2' && error.sqlMessage.includes('userId')) throw new BoxError(BoxError.NOT_FOUND, 'User not found');
|
||||
if (error && error.code === 'ER_NO_REFERENCED_ROW_2') throw new BoxError(BoxError.NOT_FOUND, 'Group not found');
|
||||
if (error) throw error;
|
||||
}
|
||||
|
||||
async function setMembers(groupId, userIds) {
|
||||
assert.strictEqual(typeof groupId, 'string');
|
||||
assert(Array.isArray(userIds));
|
||||
|
||||
Reference in New Issue
Block a user