trying to fix UserGroupNotFoundError (false/not triggering)

ref #14
This commit is contained in:
Philipp Dormann 2020-12-04 19:02:07 +01:00
parent a3b79ef21d
commit 451d0c92dd
1 changed files with 9 additions and 7 deletions

View File

@ -42,14 +42,16 @@ export class CreateUser {
}
let found_groups = []
this.groupId.forEach(async (g) => {
const foundGroup = await getConnectionManager().get().getRepository(UserGroup).find({ id: g });
if (foundGroup) {
found_groups.push(foundGroup)
} else {
throw new UserGroupNotFoundError();
}
const foundGroup = await getConnectionManager().get().getRepository(UserGroup).findOne({ id: g });
console.log(foundGroup);
found_groups.push(foundGroup)
});
newUser.groups = found_groups
console.log(found_groups);
if (found_groups.includes(undefined) || found_groups.includes(null)) {
throw new UserGroupNotFoundError();
} else {
newUser.groups = found_groups
}
}
const new_uuid = uuid.v4()