groups: remove unused addMember

This commit is contained in:
Girish Ramakrishnan
2024-01-19 17:25:36 +01:00
parent 06ce351d82
commit a8d37b917a
2 changed files with 0 additions and 36 deletions

View File

@@ -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));