This commit is contained in:
syuilo 2019-05-19 20:43:33 +09:00
parent e103904a04
commit 01fab09683
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 11 additions and 1 deletions

View File

@ -42,7 +42,13 @@ export const meta = {
message: 'No such user.',
code: 'NO_SUCH_USER',
id: '0b5cc374-3681-41da-861e-8bc1146f7a55'
}
},
isOwner: {
message: 'The user is the owner.',
code: 'IS_OWNER',
id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af'
},
}
};
@ -63,6 +69,10 @@ export default define(meta, async (ps, me) => {
throw e;
});
if (user.id === userGroup.userId) {
throw new ApiError(meta.errors.isOwner);
}
// Pull the user
await UserGroupJoinings.delete({ userId: user.id });
});