List Each Member's Badges

Use this one on the backend…

import { badges } from 'wix-members-backend';

export function myListMembersFunction() {
  const badgeId = "571495e9-98af-4ec9-b854-16c0293c9312";

  return badges.listMembers(badgeId)
    .then((memberIds) => {
      const firstMember = memberIds[0];
      return memberIds;
    })
    .catch((error) => {
      console.error(error);
    });
}

/*
 * Promise resolves to:
 * [
 *   "28d35f86-6694-4455-9dff-aff5d450b482",
 *   "72751428-2743-4bda-acf5-4218a4279cd3",
 *   "8831eed6-928e-4f85-b80a-e1e48fb7c4fd"
 * ]
 */

…and get all MEMBER-IDs which are asigned to a specific badge.