Return an appropriate error when removing billable members
What does this MR do?
We recently added the ability to remove a billable group member via the REST API, which uncovered an unexpected edge case - not all billable members have Member
DB records.
This is the case when a user is part of a group that was invited into another group.
This edge case caused confusion when using the API because the deletion service would complete successfully, so the response would be a 204 - No Content
for those members, even though they weren't actually removed (due to having no Member
record).
This MR seeks to address that problem by raising an appropriate error and returning a more useful error message.
Testing
curl --request DELETE \
--url http://127.0.0.1:3000/api/v4/groups/:group_id/billable_members/:any_invalid_id \
--header 'PRIVATE-TOKEN: <your private token>'
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
Edited by Vijay Hawoldar