This commit is contained in:
Angelo Gallarello 2019-02-12 23:40:12 +01:00
parent d22964bcfd
commit 477d71e0b9
13 changed files with 207 additions and 24 deletions

View file

@ -169,6 +169,31 @@ export class WekanCreator {
})]);
}
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;
const users = data.users;
// auto-map based on username
membersToMap.forEach((importedMember) => {
importedMember.id = importedMember.userId;
delete importedMember.userId;
const user = users.filter((user) => {
return user._id === importedMember.id;
})[0];
if (user.profile && user.profile.fullname) {
importedMember.fullName = user.profile.fullname;
}
importedMember.username = user.username;
const wekanUser = Users.findOne({ username: importedMember.username });
if (wekanUser) {
importedMember.wekanId = wekanUser._id;
}
});
return membersToMap;
}
checkActions(wekanActions) {
// XXX More check based on action type
check(wekanActions, [Match.ObjectIncluding({