Avoid passing undefined to values that are marked as optional

This commit is contained in:
Oliver Sand
2020-12-10 12:03:31 +01:00
parent 7c3ffc0cd4
commit 754d828fb3
@@ -158,21 +158,27 @@ export async function readMicrosoftGraphGroups(
kind: 'Group',
metadata: {
name: name,
description: group.description ?? undefined,
annotations: {
[MICROSOFT_GRAPH_GROUP_ID_ANNOTATION]: group.id,
},
},
spec: {
type: 'team',
profile: {
displayName: group.displayName,
email: group.mail ?? undefined,
},
profile: {},
children: [],
},
};
if (group.description) {
entity.metadata.description = group.description;
}
if (group.displayName) {
entity.spec.profile!.displayName = group.displayName;
}
if (group.mail) {
entity.spec.profile!.email = group.mail;
}
// Download the members in parallel, otherwise it can take quite some time
const loadGroupMembers = limiter(async () => {
for await (const member of client.getGroupMembers(group.id!)) {