Add `memberCount` to GraphQL `MemberRole` type

Why are we doing this work

The frontend needs a way to determine if a specific MemberRole can be deleted. A MemberRole with 1 or more members cannot be deleted.

To accommodate this frontend would like backend to add a memberCount field to the MemberRole type that includes the total number of members of that role. This count can then be used to determine what actions can be performed on this MemberRole from the frontend.

Relevant links

Non-functional requirements

  • Documentation:
  • Feature flag:
  • Performance:
  • Testing:

Implementation plan

Verification steps

  1. Open GraphQL Explorer: http://gdk.test:3000/-/graphql-explorer

  2. Execute the following query

    query findMemberRole($id: MemberRoleID!){
      memberRole(id:$id) {
        id
        name
        memberCount
      }
    }
    {
      "id": "gid://gitlab/MemberRole/1"
    }
  3. Verify the correct memberCount is returned in the results

Edited by mo khan