Skip to content

Commit

Permalink
BC-8592 add externalId to GroupProvisioningInfoLoggable (#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loki-Afro authored and Metauriel committed Dec 18, 2024
1 parent 573eb34 commit 584cb1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe(GroupProvisioningInfoLoggable.name, () => {
otherUsers: externalGroupUserDtoFactory.buildList(otherUserCount),
});

const loggable = new GroupProvisioningInfoLoggable(externalGroups, 100);
const loggable = new GroupProvisioningInfoLoggable(externalGroups, 100, 'igorHatGesagt');

return {
loggable,
Expand All @@ -31,6 +31,7 @@ describe(GroupProvisioningInfoLoggable.name, () => {
groupCount,
userCount: totalUserCount,
durationMs: 100,
externalUserId: 'igorHatGesagt',
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from
import { ExternalGroupDto } from '../dto';

export class GroupProvisioningInfoLoggable implements Loggable {
constructor(private readonly groups: ExternalGroupDto[], private readonly durationMs: number) {}
constructor(
private readonly groups: ExternalGroupDto[],
private readonly durationMs: number,
private readonly externalUserId: string
) {}

public getLogMessage(): LogMessage | ErrorLogMessage | ValidationErrorLogMessage {
const userCount = this.groups.reduce(
Expand All @@ -16,6 +20,7 @@ export class GroupProvisioningInfoLoggable implements Loggable {
groupCount: this.groups.length,
userCount,
durationMs: this.durationMs,
externalUserId: this.externalUserId,
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export abstract class SchulconnexProvisioningStrategy extends ProvisioningStrate
}

const endTime = performance.now();
this.logger.warning(new GroupProvisioningInfoLoggable(data.externalGroups ?? [], endTime - startTime));
this.logger.warning(
new GroupProvisioningInfoLoggable(data.externalGroups ?? [], endTime - startTime, data.externalUser.externalId)
);
}

private async removeUserFromGroups(data: OauthDataDto): Promise<void> {
Expand Down

0 comments on commit 584cb1a

Please sign in to comment.