summaryrefslogtreecommitdiffstats
path: root/client/components/import/trelloMembersMapper.js
blob: 0f353bf1eedfa21da47166079de6b6cfb49d6f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export function getMembersToMap(data) {
  // we will work on the list itself (an ordered array of objects) when a
  // mapping is done, we add a 'wekan' field to the object representing the
  // imported member
  const membersToMap = data.members;
  // auto-map based on username
  membersToMap.forEach((importedMember) => {
    const wekanUser = Users.findOne({ username: importedMember.username });
    if (wekanUser) {
      importedMember.wekanId = wekanUser._id;
    }
  });
  return membersToMap;
}