[BUG] Hidden behaviour while adding member into group
Context:
API endpoints should be understandable and easy-to-use for end user. At the moment we have some endpoints (e.g. POST /groups/:group_email/members
) that do hidden logic and may confuse users.
How it's done today:
Calling POST /groups/:group_email/members
with different structure of email will trigger the logic, that is not explained in README or any docs.
Example:
- User email in format
test-user@{{data-partition}}.{{domain}}
will be considered as a group; - User email in format
test-user@{{domain}}
will be considered as a user.
Issue with current design:
The hidden logic that was not described affects the behaviour of the endpoint. The user may not define what kind of member will be set as a child in the group.
Proposal:
Separate the logic in two different methods. For example:
- createUser(userEmail),
- createGroup(groupEmail).